c# – The “this” keyword

Earlier we cam across the following: If you look at the above code, you will notice that the employee class’s constructor has input parameters that are called Firstname, Salary, and Age. But these names are also used as the names of the Employee class’s properties. As a result it can […]Read more »

c# – Declare variables outside if-else statement scope

If you declare (and initialize) a variable within an if-else statement, then that variable’s value will only exist within that if-else statement. However if you want to initialize (i.e. assign a value to) the variable within the if-else statement, but want to make the variable accessible outside the if-else scope, […]Read more »

c# – Embed variables in a string using the substition technique

Previously in the boolean chapter we saw: We can use a technique called substitution as a shorthand, and simpler way to embed objects in strings. It works by embedding curly-braced-numbers in the string, e.g.: The linux Awk command works in a similar way. Also see: http://msdn.microsoft.com/en-us/library/fk49wtc1%28v=vs.110%29.aspx

c# – The “Main” method

In most case a c# file (aka .cs) will contain several (or hundreds of classes). After you have compiled it into an .exe file and double click on it. c# will need to know which part of the c# code needs to run first. You may some a code block […]Read more »

c# – Input Parameters and Return Values

As mentioned earlier, a method is a block of code that performs a specific task. Methods can require some information in order for it to run. This info has to be provided in the form of an “input parameter” Methods can also output information after it has completed running. This […]Read more »

c# – Static and Non-Static Methods

C# is a object oriented language, and that means that whenever we declare a new variable, we are actually using a class that generates (aka instantiates) that variable for us. Let’s says that somewhere in our program we have the following statement: int MyFavouriteNumber = 7 ; Here we are […]Read more »