My Blog

Here you can find my private notes about programming that I wanted to share with you. Feel free to filter based on the topic you want or search for something specific.

    How to copy data-files to the TestResults folder of your MSTest unit-tests

    When running unit-tets you will often want to read data from .txt or .xml files. On the runtime, these files have to be copied to the TestResults folder. By choosing Copy to Output Directory: Copy always or Build Action: embedded Resource for these files will not help and the file is not found when the unit-test runs.

    Read the complete article

    Enable warnings about possible null references in your Visual Studio project

    All .NET programmers had dealt at least once on their career with a null reference exception on a code line they wrote. Most of the times a parameter of a method is null, the code is not aware of it and the parameter is being used inside the method, for example we are accessing a property of an object. Because the value of the object is null we are getting an exception on the runtime.

    Visual Studio provides a way to inform / warn us about possible null references. Let us see how we can enable this feature on our C# project.

    Read the complete article

    The implicit operator in C# and when it can be useful

    A cool feature of C# that I lately used is the implicit operator keywords and with them we can define the way for converting one type into another one implicitly. A good scenario when you can use that is presented in this example.

    Read the complete article

    A list of my favorite C# examples using Reflection

    This article contains a list of code lines, that use reflection to access data in classes. Reflection can be combined with Generics and even though some might think it can be hacky, I find that Reflection offers a tremendous advantage when dealing with monolithic application and you want to write reusable code, and you can not use object oriented concepts such as inheritance. Let’s start without further delay.

    Read the complete article

    How to update your Azure Functions from version 2 (V2) to version 3 (V3)

    Here is a small and quick article about how to perform the update in your C# project that contains the Azure Functions of your application

    Read the complete article