New types of parameters in C sharp
What do you know about parameter and explain new types of the parameters introduced in the C# 4.0?
Expert
The parameter is a special type of variable that is used in the function to offer a piece of information or the input to the caller function. Inputs are known as arguments. In C#, there are different kinds of parameters which are as follows:
1. Output type – It refers that you require to state out keyword with the parameter.
2. Value type – It refers that we do not require to give any keyword with the parameter.
3. Reference type – It refers that we need to state a ref keyword with the parameter.
4. Optional parameter – It refers to a new parameter introduced in the C# 4.0. It permits us to neglect the parameters which have a number of predefined default values. Example of optional parameter is:
public int Sum(int a, int b, int c = 0, int d = 0); /* c and d is optional */
Sum(10, 20); //10 + 20 + 0 + 0
Sum(10, 20, 30); //10 + 20 + 30 + 0
Sum(10, 20, 30, 40); //10 + 20 + 30 + 40
4. Named parameter – It refers to a new parameter introduced in the C# 4.0. We can give arguments by the name rather than location. Example of named parameter is:
public void CreateAccount(string name, string address = "unknown", int age = 0);
CreateAccount("Sara", age: 30);
CreateAccount(address: "India", name: "Sara");
In what way we can check/uncheck every item in a CheckedListBox control in the .NET 4.0 framework?
What do you mean by the term non_deterministic finalization?
Write the name of the methods available in .NET 4.0, which are used to add and delete items from the ListBox control?
Write down the three main points in WCF?
Which method is used in .NET to enforce garbage collection?
Describe the role of new keyword in brief.
Define Web server controls as well as HTML?
Write the chief features of the Cloud services?
Illustrate the term lazy initialization?
In what way we can enable the text box to modify its characters format for a user to enter the password?
18,76,764
1929143 Asked
3,689
Active Tutors
1432150
Questions Answered
Start Excelling in your courses, Ask an Expert and get answers for your homework and assignments!!