Holistic approach or high level approach are common phrases you will hear when beginning the design of a new system or the start of a new project that will modify or enhance an existing program. Therefore, when you begin a new project, start from the solution context. This means, know what the program does end-to-end […]
Read More →Archive for May, 2020
Booleans and Bools in C#
In a job interview I had once, I was asked, “How do you store a Boolean in a database?” My first reaction was to say, True, False, 0, 1, Y or N. However, this question has some depth to it. I do not know why, if you do let me know, but there are no […]
Read More →Constants and Enums in C#
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 →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 →