Constants come in handy when you need to store values that will be used frequently within the system and at the same time will not change often, if ever. You want to avoid hard coding values in you code. It makes maintenance and debugging very difficult. You can create a constants class and then access […]
Read More →Category: C# Blogs
How to use Data Parallelism from the Task Parallel Library in C#
I wrote a program a few months back that populated a dropdown list with contents from a class using reflection. I used a normal for each statement. [sourcecode language=”csharp” padlinenumbers=”true” autolinks=”false” gutter=”false” toolbar=”false”] foreach (Type type in assembly.GetTypes() .OrderBy(f => f.MetadataToken)) { if (type.Namespace != null) { if (!type.Namespace.ToLower().StartsWith(“namespace”)) combobox1.Add(new ComboBoxClass(type.Name, type.FullName)); } } [/sourcecode] […]
Read More →How to get a treeview item node value using a ContextMenu using WPF and C#
The first things you need to note is that the treeview node needs to be selected in order for you to get any information from it. I did read some articles about using the System.Windows.Point to get the X, Y coordinates of the mouse, but I chose to go another route. Using the Point class […]
Read More →Sandcastle XML documentation for Visual Studio and C#, How to install and configure Sandcastle.
I know we as programmers like to write code. However, most of the time we don’t get to start from the beginning. Most often we get to modify and enhance code that has been written by someone else. Let’s make a deal, from now on let’s document our code so we don’t have to spend […]
Read More →WPF DataGrid Navigation Paging Up Down Sideways is slow virtualization
I was developing a WPF application that allowed users to selected as many rows and as many columns that were available in the database. I dynamically built the selection criteria using reflection and a treeview. Then I traversed the treeview and dynamically built the DataGrid that contained the columns and thier values. What I quickly […]
Read More →How do Margins in WPF work
When you add a control to your WPF container you typcally set the width and height to align it within the window and in relation to other controls. An alternative to this is to set the controls margin in relation to the container. This plays an important role when you want to add GridSplitters and […]
Read More →Adding existing projects to an existing solution hosted on GitHub
I have written number of articles about configuring GitHub and deploying some code to it. Here is a list of them just in case you want to get some perspectives and better know where I am coming from. Setting up and using GitHub in Visual Studio 2017 Setting up and using GitHub in Visual Studio […]
Read More →How to connect to a database from an Azure Function using Azure Key Vault
In my original article here where I stored the database connection string in an Environment Variable which is no longer an optimal approach (it was only for example). I will now update the Azure Function to access an Azure Key Vault secret which has the database connection string and use it to make the database […]
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 →ASP.NET Core 2.1 and HTTP Error 502.5 – Process Failure
I was deploying my ASP.NET Core 2.1 64-bit HelloWorld application and got this error, Figure 1. Figure 1, ASP.NET Core 2.1 502.5 x64 64 bit Common causes of this issue: The application process failed to start The application process started but then stopped The application process started but failed to listen on the configured port […]
Read More →