Do NOT use for questions about .NET Core - use [.net-core] instead. The .NET framework is a software framework designed mainly for the Microsoft Windows operating system. It includes an implementation of the Base Class Library, Common Language Runtime (commonly referred to as CLR), Common Type System (commonly referred to as CTS) and Dynamic Language Runtime. It supports many programming languages, including C#, VB.NET, F# and C++/CLI.
Example (note the case):
string s = "Hello world!";
String s = "Hello world!";
What are the guidelines for the use of each? And what are the differences?
How can you enumerate an enum in C#?
E.g. the following code does not compile:
public enum Suit
public void EnumerateAllSuitsDemoMethod()
What are the correct version numbers for C#? What came out when? Why can't I find any answers about C# 3.5?
This question is primarily to aid those who are searching for an answer using an incorrect ...
I want to do something like:
MyObject myObj = GetMyObj(); // Create and fill a new object
MyObject newObj = myObj.Clone();
And then make changes to the new object that are not reflected in the ...
It is discouraged to simply catch System.Exception. Instead, only the "known" exceptions should be caught.
Now, this sometimes leads to unnecessary repetitive code, for example:
How do I convert a string to a byte in .NET (C#) without manually specifying a specific encoding?
I'm going to encrypt the string. I can encrypt it without converting, but I'd still like to know ...
What is the difference between decimal, float and double in .NET?
When would someone use one of these?
I have been running StyleCop over some C# code, and it keeps reporting that my using directives should be inside the namespace.
Is there a technical reason for putting the using directives inside ...
Given a DateTime representing a person's birthday, how do I calculate their age in years?
How can I create an Excel spreadsheet with C# without requiring Excel to be installed on the machine that's running the code?
I have some code and when it executes, it throws a NullReferenceException, saying:
Object reference not set to an instance of an object.
What does this mean, and what can I do to fix this error?
A C# desktop application on the express edition worked, but then it didn't work 5 seconds later.
I tried the following:
Ensure debug configuration, debug flag, and full debug information are set on ...
I know from reading the Microsoft documentation that the "primary" use of the IDisposable interface is to clean up unmanaged resources.
To me, "unmanaged" means things like database connections, ...
If I inherit from a base class and want to pass something from the constructor of the inherited class to the constructor of the base class, how do I do that?
For example, if I inherit from the ...
This question already has an answer here:
How do I enumerate an enum in C#? 26 answers
public enum Foos
Is there a way to loop through the possible values of Foos?