Error When Using “class” Constraint on a Typed Parameter; C# Generics

The following errors:

public class LinkedEntitySet<T, U, V> : IList<U>, IListSource
        where T : IParent<T>
        where U : IShared<U>
        where V : ILink<T, U>, class

The following doesn’t:

public class LinkedEntitySet<T, U, V> : IList<U>, IListSource
     where T : IParent<T>
     where U : IShared<U>
     where V : class, ILink<T, U>

Error recieved originally:

Error    1    The type ‘V’ must be a reference type in order to use it as parameter ‘TEntity’ in the generic type or method ‘System.Data.Linq.EntitySet<TEntity>’   

Compile error with class after ILink<T, U>:

Error    1    The ‘class’ or ‘struct’ constraint must come before any other constraints   

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