1 single choice
Regarding C# generics, the following description is correct
A. The type parameter names of different generic methods must be different
. B. The type parameter can only be declared once in the type parameter table, but it can appear multiple times in the method parameter table.
C. All generic method declarations place the type parameter table In front of the method name
D. The type parameter can only have at most one interface constraint, but there can be multiple class constraints
Answer: B
2 single choice
Regarding the constraints of generics in C#, the wrong description is
A.where T: IFoo means that the T must be replaced by the interface
B.where T: struct means that the T to be replaced must be a structure type
C.where T: new() means that the T must be replaced must have a default constructor Type
D.where T: class indicates that T must be replaced by a reference type
Answer: B
analysis: where T: struct means that the T to be replaced must be a numeric type
3 Judgment
statement Stack objectStack=new Stack (); indicates that objectStack saves int variables.
Answer: yes
4 To determine
the type parameter list of the generic method is separated by (). The type parameter specifies the type and return type of the method argument.
Answer: yes