Category: C# Fundamentals

Dictionary in C#

I am finding that as you learn to use and implement more sophisticated programming techniques the easier it becomes to created what many would call “complex algorithms”. I believe this, just think about what alternative you have to a Dictionary. I mean other than the similar methods found in the System.Collections or Systems.Collections.Generic classes. Configuration […]

Read More →

Conditional Methods

Benjamin Perkins C#

One of, if not the most important concepts in software programming is that of Conditional Methods. Conditional methods provide a program with the ability to make decisions based on user input, user selections or data values. The code below is a simple example of a conditional method: [sourcecode language=”csharp” padlinenumbers=”true” autolinks=”false” gutter=”false” toolbar=”false”] public static […]

Read More →

Interface in C#

An interface is like a contract. When a person signs a contract they are agreeing to perform in adherence to its’ contents. The person can take any action which is not specifically identified in the contract or build on top of the agreements within it. An interface has a similar concept. In this example I […]

Read More →

Anonymous Method / Delegate

Benjamin Perkins C#

Delegates in C# are similar to function pointers in C++ and allow methods to be passed as parameters. In this example we will create a delegate called CalculateCharge and a Withdrawal class: [sourcecode language=”csharp”] delegate decimal CalculateCharge(decimal withdrawal); class Withdrawal { public string AccountOwnerName; public decimal withdrawal; public decimal charge; public CalculateCharge calculation; } [/sourcecode] […]

Read More →

Arrays in C#

Benjamin Perkins C#

I always liked the concept of arrays. Being able to conceptually visualize in multiple dimensions took me some time to get my mind around, but in the end I was successful. The example here will discuss 2 dimensional arrays of type single, multiple and jagged. A single dimensional array is the simplest. You simply code […]

Read More →

Generics

Benjamin Perkins C#

When we think about the word Generic outside of the programming world it simply means that the object is not tied to any specific kind. An example is a bank account. We may not know which bank it is associated too, if it is a checking or savings account, however we do know that we […]

Read More →