Monday, August 16, 2010

Genirics in C#--Simple Example

C# 2.0 has introduced concept of generics,Iterators,Anonymous Methods.
Let's consider concept of generics. So What is generics?

Generics is type of data structure.This results in a significant performance boost and higher quality code, because you get to reuse data processing algorithms without duplicating type-specific code.It wont follow any data type rule while compailation. i.e no need to define any data type while defining. You can define generic interfaces, classes, methods, events and delegates.

Example: Consider implementaion of generics to class.



So,
1.generic types to maximize code reuse, type safety, and performance.
2.The most common use of generics is to create collection classes.



Thanks!!
aravindbenator@gmail.com

No comments:

Post a Comment