Some Generic Restrictions


Here are a few restrictions that you need to keep in mind when using generics:

  • Properties, operators, indexers, and events cannot be generic. However, these items can be used in a generic class and can make use of the generic type parameters of that class.

  • The extern modifier cannot be applied to a generic method.

  • Pointer types cannot be used as type arguments.

  • If a generic class contains a static field, then each constructed type has its own copy of that field. This means that each instance of the same constructed type shares the same static field. However, a different constructed type shares a different copy of that field. Thus, a static field is not shared by all constructed types.




C# 2.0(c) The Complete Reference
C# 2.0: The Complete Reference (Complete Reference Series)
ISBN: 0072262095
EAN: 2147483647
Year: 2006
Pages: 300

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net