Top ".net" questions

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

How do you unit test private methods?

I'm building a class library that will have some public & private methods. I want to be able to unit …

.net unit-testing tdd private
Returning a value from thread?

How do I return a value from a thread?

c# .net multithreading
Warning: Found conflicts between different versions of the same dependent assembly

I am currently developing a .NET application, which consists of 20 projects. Some of those projects are compiled using .NET 3.5, some …

.net warnings
C# equivalent of the IsNull() function in SQL Server

In SQL Server you can use the IsNull() function to check if a value is null, and if it is, …

c# .net sql-server isnull
Best practices for catching and re-throwing .NET exceptions

What are the best practices to consider when catching exceptions and re-throwing them? I want to make sure that the …

c# .net exception-handling rethrow
Binding an enum to a WinForms combo box, and then setting it

a lot of people have answered the question of how to bind an enum to a combo box in WinForms. …

c# .net winforms combobox enums
How to remove the focus from a TextBox in WinForms?

I need to remove the focus from several TextBoxes. I tried using: textBox1.Focused = false; Its ReadOnly property value is …

c# .net winforms textbox focus
.NET Events - What are object sender & EventArgs e?

What do sender and eventArgs mean/refer to? How can I make use of them (for the scenario below)? Scenario: …

.net events event-handling
Transactions in .net

What are the best practices to do transactions in C# .Net 2.0. What are the classes that should be used? What …

c# .net transactions
How to specify the port an ASP.NET Core application is hosted on?

When using WebHostBuilder in a Main entry-point, how can I specify the port it binds to? By default it uses 5000. …

.net asp.net-core