Top ".net" questions

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

Array versus List<T>: When to use which?

MyClass[] array; List<MyClass> list; What are the scenarios when one is preferable over the other? And why?

.net arrays list
Which Radio button in the group is checked?

Using WinForms; Is there a better way to find the checked RadioButton for a group? It seems to me that …

c# .net winforms radio-button
Process.start: how to get the output?

I would like to run an external command line program from my Mono/.NET app. For example, I would like …

c# .net mono process.start
How to compare only Date without Time in DateTime types in Linq to SQL with Entity Framework?

Is there a way to compare two DateTime variables in Linq2Sql but to disregard the Time part. The app …

c# .net database entity-framework linq-to-sql
Trim last character from a string

I have a string say "Hello! world!" I want to do a trim or a remove to take out the ! …

c# .net
Insert data using Entity Framework model

I'm trying to insert some data in my database using Entity Framework model, but for some unknown reasons to me, …

c# .net entity-framework
What is the C# Using block and why should I use it?

What is the purpose of the Using block in C#? How is it different from a local variable?

c# .net syntax using using-statement
How to Find And Replace Text In A File With C#

My code so far StreamReader reading = File.OpenText("test.txt"); string str; while ((str = reading.ReadLine())!=null) { if (str.Contains("…

c# .net io streamreader file-handling
LINQ: When to use SingleOrDefault vs. FirstOrDefault() with filtering criteria

Consider the IEnumerable extension methods SingleOrDefault() and FirstOrDefault() MSDN documents that SingleOrDefault: Returns the only element of a sequence, or …

.net linq linq-to-sql
Getting Http Status code number (200, 301, 404, etc.) from HttpWebRequest and HttpWebResponse

I am trying to get the HTTP status code number from the HttpWebResponse object returned from a HttpWebRequest. I was …

c# .net http httpwebrequest