Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 98577

C# is a multi-paradigm, managed, garbage-collected, object-oriented programming language created by Microsoft in conjunction with the .NET platform. Use this tag for questions related to C#. In case a specific version of the framework is used, you could also include that tag; for instance .net-2.0.

2 votes

Replace enums by inheritance

t3chb0t's answer seems like a pretty good solution, I don't feel like much can be improved on that but instead I'd like to touch on another part of your question. Your event handlers all do the same …
Denis's user avatar
  • 8,508
3 votes

Making generic code when using large Enums

Overview Your code doesn't look good. Here are some of the reasons why. You have a bug You have tons of repetitive code Your naming is poor e.g PropertyA, PropertyB... It would be difficult to exte …
Denis's user avatar
  • 8,508
1 vote

Smart copy for Windows CE in C#

The using statement You shouldn't call .Close() or .Dispose() manually the using statement is usually preferred and in your case it will even remove the finally block : private void ReadFiles(strin …
Denis's user avatar
  • 8,508
6 votes

RoomModel class

You can get rid of the long switch case like this: public static short ParseModelSquare(char input) { if (char.IsDigit(input)) { return (short) (input - 48); } if (char.IsLett …
Denis's user avatar
  • 8,508
3 votes
Accepted

Cache storage data structure

CacheItem You're not really using the Key property of the CacheItem class, you're always operating with the parameter, you can either remove the property as it's redundant or use that instead of the …
Denis's user avatar
  • 8,508
4 votes
Accepted

Analysis describing the combination of cards

The order is not the problem here but rather the fact that you have multiple virtual calls in your constructor. This is really bad because in your derived class, when they are being instantiated, your …
Denis's user avatar
  • 8,508
3 votes

Getting weather data from Open Weather Map API

You don't need to explicitly declare a backing field for your properties private string city; public string City { get { return city; } set { city = value; } } You can shorten it to this …
Denis's user avatar
  • 8,508
3 votes
Accepted

A class for solving a system of linear equations using Gaussian Elimination

Enumerable.Count() vs count access One problem that slows your program's performance is that you call Coefficients.Count() In a few places while you are using array instead of an IEnumerable<T> w …
Denis's user avatar
  • 8,508
3 votes
2 answers
453 views

Find all possible sumation numbers to a specified sum

This is a problem that I had in mind for a loong time and today I decided to give it a go, the basic idea is you enter a number/sum and the program outputs all the possible ways this sum can be formed …
Denis's user avatar
  • 8,508
6 votes
1 answer
1k views

Defining what combination the user have in Poker

I'm developing a C# Poker app and I currently use the modulus and the divide operator % , / and dividing by 4 because there are 4 cards of the same type but with different colors. The deck of cards fo …
Denis's user avatar
  • 8,508
2 votes
1 answer
195 views

Bitwise operator guide

I'm developing a console app which is supposed to teach how the bitwise operators in C# work. It will include tutorials, training fields and all that good stuff. I have a problem with the naming of my …
Denis's user avatar
  • 8,508
7 votes

LDAP search helper for System.DirectoryServices.Protocols

You have too much unnecessary comments such as - Private backing field for ..., you don't really care about the backing field of a property anyway. Convert your properties into auto properties like …
Denis's user avatar
  • 8,508
1 vote
Accepted

PainlessDictionary for painless debugging

Don't have much to say about the code as it's rather simple and not much can be changed on most places, but I will give my two cents. Besides the fact that you can add some extra info in the exceptio …
Denis's user avatar
  • 8,508
6 votes
Accepted

Updating database based on selected check boxes

OMITTING CURLY BRACES ? Don't do that a single line statements like this are acceptable even tho they are still not recommended you should always have {} : if (Foo is Bar) return "Foo is Bar"; e …
Denis's user avatar
  • 8,508
9 votes
Accepted

Creating a List of objects of a particular type only

You can use the LINQ extension method IEnumerable.OfType<TResult>(), it returns any elements matching the type of the specified generic type argument: var jointLoads = AllLoadCases.OfType<JointsLoadi …
Denis's user avatar
  • 8,508

1
2 3 4 5
11
15 30 50 per page