One of the cool features of the .NET Core is that the namespaces you reference in the project are the only ones that are contained in the DLL your project renders. I was reading that when you initially create a project in Visual Studio, that numerous packages are included by default and was wondering, because […]
Read More →Tags: C#
Targeting a specific version of the .NET Framework
I find numerous opinions and understandings about side-by-side and in-place installations of the .NET Framework. Here is my favorite explanation of this “.NET Versioning and Multi-Targeting – .NET 4.5 is an in-place upgrade to .NET 4.0”. I also link to that same article in one of my IIS labs here, “Lab 5: Basic and Advanced […]
Read More →What is the current .NET version on an Azure App Service
I have an App Service here (currentdotnetversion) that shows the output of the current (when I wrote this article) .NET version using C# code. Here is a partial code snippet: protected void Page_Load(object sender, EventArgs e) { const string subkey = @”SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\”; using (RegistryKey ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey(subkey)) { […]
Read More →CulturInfo not working as expected in C#
I have started working with Globalization and Localization functionality for a system I am building. I could not understand why, when I wanted to get the intellisense for the class that nothing showed up. After some time I decided to use the full name of the class to get to the methods like this: [sourcecode […]
Read More →Dynamic Type in C#, in comparison to var Type
Knowing the type of variable you are working with in C# and while programming in general is pretty important. You can’t add a double and an integer together and get an integer, without converting it. If you attempt to do this the compiler will throw an exception and you will not be able to run […]
Read More →Find a specific value within a generic list with a Lambda Expression using C#
With the release of C# 3.0 came Lambda Expressions. In a previous post I searched a generic list using a delegate, this is because, perhaps, I have done so much programming with C# 2.0 that it’s just a habit now. Time to move onto better, newer things, like Lambda Expressions. In the previous example I […]
Read More →Find a specific value within a generic list using C#
It is common to have a need to search though a generic list to know if it contains a specific value. This is where the Find() method can be used. There are many different scenarios you may encounter for searching, I will cover 2 here. The first is searching a list which contains a Class […]
Read More →Add Key Value Pairs to a Combobox using WPF and C#
It’s pretty easy to populate and read from a ComboBox when the selected item is the same as the selected value. I.e. just simply use: [sourcecode language=”csharp” padlinenumbers=”true”] string selection = comboBox1.SelectedValue.ToString(); [/sourcecode] However, when you need the value to be different from the item (I.e. display value). Perhaps you want to display the Month […]
Read More →How (I) would handle a timeout in Azure Function
I wrote this article about adding a host.json file to an Azure Function “How to add a HOST.JSON file to an Azure Function” and while I was breaking it, I saw a behavior which I didn’t expect. The behavior was that my code within the try…catch… block continued to execute after the timeout, the code […]
Read More →How to add a HOST.JSON file to an Azure Function
I have written numerous articles about Azure Functions, view them here. NOTE: If you make changes to your function through KUDU/SCM or FTP it is likely those changes will not get synchronized. Please read here for more on that topic. The fact is, the HOST.JSON file is created for you when the Azure Function App […]
Read More →