Top ".net" questions

Do NOT use for questions about .NET Core - use [.net-core] instead.

What are the correct version numbers for C#?

What are the correct version numbers for C#? What came out when? Why can't I find any answers about C# 3.5? …

c# .net visual-studio .net-framework-version compiler-version
Converting Stream to String and back...what are we missing?

I want to serialize objects to strings, and back. We use protobuf-net to turn an object into a Stream and …

c# .net serialization deserialization protobuf-net
How does lock work exactly?

I see that for using objects which are not thread safe we wrap the code with a lock like this: …

c# .net synchronization locking thread-safety
How to split() a delimited string to a List<String>

I had this code: String[] lineElements; . . . try { using (StreamReader sr = new StreamReader("TestFile.txt")) { String line; while ((line = sr.ReadLine()) != …

c# .net list arraylist
A generic list of anonymous class

In C# 3.0 you can create anonymous class with the following syntax var o = new { Id = 1, Name = "Foo" }; Is there a …

c# .net generics anonymous-types
Why is the console window closing immediately once displayed my output?

I'm studying C# by following the guides in MSDN. Now, I just tried the Example 1 (here is the link to …

c# .net console-application msdn
Attempted to read or write protected memory. This is often an indication that other memory is corrupt

I'm hoping someone can enlighten me as to what could possibly be causing this error: Attempted to read or write …

c# .net multithreading memory-management
How do I extract text that lies between parentheses (round brackets)?

I have a string User name (sales) and I want to extract the text between the brackets, how would I …

c# .net regex
How to build a query string for a URL in C#?

A common task when calling web resources from a code is building a query string to including all the necessary …

c# .net url query-string
Proper use of the IDisposable interface

I know from reading the Microsoft documentation that the "primary" use of the IDisposable interface is to clean up unmanaged …

c# .net garbage-collection idisposable