Generics in C#

Right, so I realised that generics is the answer to all the worlds problem(and did so a long time ago), but somewhere along the line, I’m irritated that in C#, in order to specify a class as a constraint, you have to both specify it as a class, and specify that it has a new() method, isn’t that what specifies a class? That it can be instanciated?

public abstract class Entry<T> where T: class, new()

Advertisements

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