.NET2.0 Base Class Library 系列(四)泛型 Generics Type

  1. introduction to Generics
    Generic classes and methods combine reusability, type safety and efficiency in a way that their non-generic counterparts cannot. Generics are most commonly used with collections and the methods that operate on them. Because no casting needed,no boxing needed.
  2. Benefits of Generics
    By creating a generic class, you can create a collection that is type-safe at compile-time.
    1using System.Collections.Generic;
    2
    3public List<int> myList = new List<int>();
    4
    Use generic types to maximize code reuse, type safety, and performance.
  3. http://msdn2.microsoft.com/en-us/library/512aeb7t(vs.80).aspx
posted @ 2007-12-03 15:57  许晓光  阅读(194)  评论(0)    收藏  举报