Author Archives: compitionpoint - Page 29
Enumeration
Enumeration is a way of defining your own type that can accept a predefined set of values identified by names. For example, you want a variable that can only store directions…
Command Line Arguments
To successfully run a C# application, you must provide a Main method. The Main() method is the starting point of the program. It is declared public or internal, and it must also be static. You can actually…
Delegates
Delegates are types that hold references to methods instead of variables. A delegate can copy the behavior of any method. To declare a delegate, you use the delegate keyword. Declaring a delegate is…
Recursion
Recursion is a process where a method calls itself repeatedly until it arrives on a desired value. Recursion is a complex topic in programming and mastering it is not that easy.…
Method Overloading
Method overloading allows you to declare two methods with the same name but has different signatures or parameter set. The program will automatically detect which method you are calling by looking…
Optional Parameters
Optional parameters, as the name suggests, are optional and you have a choice whether to provide the argument or not. Optional parameters are assigned with default values. If you do…
Variable Scopes
Variable Scope in C# have a scope. The scope tells where the variable is available or where in the program it can be accessed. For example, variables declared inside a…
C# params Keyword
The C# params keyword permits you to pass any variety of arguments that has an equivalent knowledge sort so store them into one single array parameter. The code below demonstrates…
Arrays as Arguments
You can pass arrays as arguments to a method. You have to specify the parameters of the method that it will accept an array. Let’s take a look at an…
Out Parameters
C# Out parameters are parameters that can accept uninitialized variables or arguments. The out keyword is used when passing an uninitialized variable to a method. Uninitialized variables are variables that contain no value or…