public abstract class BaseEntityCollection<T> : List<T> where T : BaseEntity, new()

Izi

Izi

Soldato
Joined
9 Dec 2007
Posts
2,718
Can someone help me understand this class:

public abstract class BaseEntityCollection<T> : List<T> where T : BaseEntity, new()
{ }

You would then spcify a new Collection of Typ T such as:

public class AddressCollection : BaseEntityCollection<Address> {}

So does the abstract class read:

"create a new BaseEntityCollection of type T which inhreits properies of list of type T Where T inhreits from the base class of T"?

I am probably completly wrong, so I'd be helpful if someone could explain it to me in a little more detail, in laymans for now !
 
Basically it says "declare a generic, abstract (i.e. uninstantiable) class called BaseEntityCollection that accepts a type parameter T and inherits from List<T>, where T is a subtype of BaseEntity and has a parameterless constructor". So yeah, you're pretty much right, but you got the terminology a bit wrong (it's not creating a BaseEntityCollection, it's simply defining it).
 
Last edited:
Basically it says "declare a generic, abstract (i.e. uninstantiable) class called BaseEntityCollection that accepts a type parameter T and inherits from List<T>, where T is a subtype of BaseEntity and has a parameterless constructor". So yeah, you're pretty much right, but you got the terminology a bit wrong (it's not creating a BaseEntityCollection, it's simply defining it).

ok, think I understand. What is the , new() for at the end?
 
Thanks Inquisitor!

Out of interest - do you use the built in .NET membership provider, or do you write your own code?

So far I have been using standard .NET provider with my own profile provider...
 
Back
Top Bottom