Category: C# Fundamentals

Interface in C#

Benjamin Perkins 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 →

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: When run, it opens a console and requests […]

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 →

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: Our Program class will create 2 delegates to execute the calculation. The first delegate will be named and the second one will be […]

Read More →