Skip to main content

Questions tagged [c#]

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.

258 votes
14 answers
54k views

We're calculating entropy of a string a few places in Stack Overflow as a signifier of low quality. I whipped up this simple method which counts unique characters in a string, but it is quite ...
Jeff Atwood's user avatar
  • 3,695
206 votes
5 answers
36k views

I'm implementing Dijkstra's algorithm with a priority queue for a game I'm developing in Unity with C#. I was a bit disappointed with the performance, so I decided to port the code to C++ and see if ...
Overv's user avatar
  • 1,982
110 votes
16 answers
244k views

I want to generate a list of N different random numbers: ...
Kao's user avatar
  • 2,434
92 votes
9 answers
9k views

The question is probably quite simple, but I would like to hear what drawbacks we will have with our code. So, we had a simple implementation and interface for it: ...
kyrylomyr's user avatar
  • 1,005
87 votes
5 answers
26k views

Even though it's the first time I'm writing something this "big", it feels like I know C# quite well (it is very similar to Java after all). It's been nice to learn LINQ also and I am very impressed ...
Simon Forsberg's user avatar
82 votes
8 answers
227k views

Imagine that I need a color palette for my Winforms application to have a consistent look. What I did was create a static helper class and helper methods that I can call from anywhere in my code, and ...
user avatar
79 votes
16 answers
6k views

Does this part look clean enough? Any suggestions on how to make it cleaner? ...
vorou's user avatar
  • 999
70 votes
4 answers
59k views

I am about to >explode< :) due to amount of reading on this subject... My head hurts, and I need some honest opinions... There is a similar question/review that I noticed, but I believe my approach ...
zam6ak's user avatar
  • 811
67 votes
9 answers
30k views

Is this the best way to implement this pattern in C#? ...
Aim Kai's user avatar
  • 772
61 votes
11 answers
14k views

I applied for an Application Developer position. They require all their applicants to complete 1 of 3 programming assignments. I picked one for sales tax calculation. It was quite simple. Write ...
John's user avatar
  • 627
58 votes
4 answers
166k views

Is there a simple way to create a comma delimited string from a list of items without adding an extra ", " to the end of the string? I frequently need to take an ASP.NET CheckBoxList and format the ...
Josh Earl's user avatar
  • 895
58 votes
1 answer
88k views

Suppose we have an enum called "Planet" and it has a custom attribute of class "PlanetAttr", these methods will give you the attribute value for a given Planet value: ...
finnw's user avatar
  • 777
56 votes
3 answers
55k views

I have two code examples that I wrote for best practices encrypting a string that I'm looking for feedback both in terms of best practices and security. They are both using authenticated encryption. ...
55 votes
2 answers
89k views

I've got this method and I realize that an instance of HttpClass is going to be created for each call to it. While working seemingly OK, I'm considering moving it ...
Konrad Viltersten's user avatar
52 votes
7 answers
8k views

I just spent the last few days constructing the currency system for my game, and was wondering if you guys had any suggestions on how—if at all—I could improve it. Before I show the code, let me ...
Krythic's user avatar
  • 1,508

15 30 50 per page
1
2 3 4 5
665