Archives for C# - Page 8
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…
Passing Arguments by Reference
Arguments can be passed by reference. That simply means that we are passing the address of the variable and not its value. Pass by reference is useful when you are…
Parameters and Arguments
Parameters give a method something to play with. They are like raw information that the method will process to give you the data you are looking ; Imagine parameters as information you…