Interview Question
Qus: What is the purpose of Generics?
Generic types to maximize code re-usability, type safety, and performance. The main common use of generics is to create collection classes. The .NET Framework class library contains many new generic collection classes in the
System Collections. Generic namespace. These can be used whenever possible instead of classes such as Array List in the System. Collections namespace. We can create our own generic interfaces, classes, methods, events and delegates. Generic may be constrained to enable access to methods on data types. The information on the types that are used in a generics data type may be obtained at run-time by using reflection.
Answers (2)
System Collections. Generic namespace. These can be used whenever possible instead of classes such as Array List in the System. Collections namespace. We can create our own generic interfaces, classes, methods, events and delegates. Generic may be constrained to enable access to methods on data types. The information on the types that are used in a generics data type may be obtained at run-time by using reflection.