Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Home
»
C# Programming
»
Generics
Which of the following statements is valid about generic procedures in C#.NET?
All procedures in a Generic class are generic.
Only those procedures labeled as Generic are generic.
Generic procedures can take at the most one generic parameter.
Generic procedures must take at least one type parameter.
None of the above.
Correct Answer:
Generic procedures must take at least one type parameter.
← Previous Question
Next Question→
More Questions from
Generics
Which of the following statements is valid about advantages of generics?
Which of the following statements are valid about generics in .NET Framework? Generics is a language feature. We can create a generic class, however, we cannot create a generic interface in C#.NET. Generics delegates are not allowed in C#.NET. Generics are useful in collection classes in .NET framework. None of the above
For the code snippet given below, which of the following statements is valid? public class Generic
{ public T Field; } class Program { static void Main(string[ ] args) { Generic
g = new Generic
(); g.Field = "Hello"; Console.WriteLine(g.Field); } }
For the code snippet given below, which of the following statements are valid? public class MyContainer
where T: IComparabte { // Insert code here } Class MyContainer requires that it's type argument must implement IComparabte interface. Type argument of class MyContainer must be IComparabte. Compiler will report an error for this block of code. This requirement on type argument is called as constraint.
For the code snippet given below, which of the following statements are valid? public class MyContainer
where T: class, IComparable { //Insert code here } Class MyContainer requires that it's type argument must implement IComparable interface. Compiler will report an error for this block of code. There are multiple constraints on type argument to MyContainer class. Class MyContainer requires that its type argument must be a reference type and it must implement IComparable interface.
Discussion & Comments
No comments yet. Be the first to comment!
Name:
Comment:
Post Comment
Join Discussion
Discussion & Comments