Top ".net" questions

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

What is the proper way to re-throw an exception in C#?

I have a question for you that stems from my partner doing things a different way than I do. Is …

c# .net exception-handling
How to get the index of an element in an IEnumerable?

I wrote this: public static class EnumerableExtensions { public static int IndexOf<T>(this IEnumerable<T> obj, …

c# .net linq ienumerable indexof
Initializing IEnumerable<string> In C#

I have this object : IEnumerable<string> m_oEnum = null; and I'd like to initialize it. Tried with IEnumerable&…

c# .net
Getting the application's directory from a WPF application

I found solutions for Windows Forms with AppDomain but what would be the equivalent for a WPF Application object?

c# .net wpf
How can I implement static methods on an interface?

I have a 3rd party C++ DLL that I call from C#. The methods are static. I want to abstract …

c# .net interface
Build query string for System.Net.HttpClient get

If I wish to submit a http get request using System.Net.HttpClient there seems to be no api to …

c# .net http
Why not inherit from List<T>?

When planning out my programs, I often start with a chain of thought like so: A football team is just …

c# .net list oop inheritance
How to stop BackgroundWorker correctly

I have a form with 2 comboboxes on it. And I want to fill combobox2.DataSource based on combobox1.Text and …

c# .net winforms backgroundworker
Choosing the default value of an Enum type without having to change values

In C#, is it possible to decorate an Enum type with an attribute or do something else to specify what …

c# .net enums
What is an "index out of range" exception, and how do I fix it?

I'm getting one of the following errors: "Index was out of range. Must be non-negative and less than the size …

c# .net indexoutofrangeexception