Home > .NET Framework > CLR Generics – Benefits and limitations

CLR Generics – Benefits and limitations

Benefits of using generics

  • Code reuse
  • Compile time type checking
  • Performance benefits by avoiding boxing, unboxing for value types and also type compatibility checks involved with casts are needed for value types as well as reference types

A serious limitation of CLR Generics
Generic type variables cannot use operators. Isn’t it a serious one. A few workarounds http://blogs.msdn.com/ericgu/archive/2003/11/14/52852.aspx
http://www.codeproject.com/csharp/genericnumerics.asp

Advertisements
Categories: .NET Framework
  1. No comments yet.
  1. November 19, 2010 at 11:00 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: