Top ".net" questions

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

Most efficient way to check for DBNull and then assign to a variable?

This question comes up occasionally, but I haven't seen a satisfactory answer. A typical pattern is (row is a DataRow): …

.net dbnull
How to make modal dialog in WPF?

I am writing my first application in WPF and want to have the user input some data on a modal …

.net wpf dialog modal-dialog
Find a private field with Reflection?

Given this class class Foo { // Want to find _bar with reflection [SomeAttribute] private string _bar; public string BigBar { get { return …

c# .net reflection .net-attributes
Why is the Visual Studio 2015/2017/2019 Test Runner not discovering my xUnit v2 tests

UPDATE: Adding a 2019; the discovery/runner integration mechanism is same as per 2017 & 2015, so the key things that can go …

.net visual-studio unit-testing visual-studio-2015 xunit2
Can I write into the console in a unit test? If yes, why doesn't the console window open?

I have a test project in Visual Studio. I use Microsoft.VisualStudio.TestTools.UnitTesting. I add this line in one …

c# .net visual-studio unit-testing console-application
Logging best practices

I'd like to get stories on how people are handling tracing and logging in real applications. Here are some questions …

.net asp.net logging trace
Developing C# on Linux

I'd like to know if there are effective and open source tools to develop C# applications on Linux (Ubuntu). In …

c# .net linux winforms ide
Most common C# bitwise operations on enums

For the life of me, I can't remember how to set, delete, toggle or test a bit in a bitfield. …

c# .net enums bit-manipulation flags
Path to MSBuild

How can I programatically get the path to MSBuild from a machine where my .exe is running? I can get …

.net msbuild
Dependent DLL is not getting copied to the build output folder in Visual Studio

I have a visual studio solution. I have many projects in the solution. There is one main project which acts …

c# .net visual-studio-2010 dll reference