I have a research about feature “Data Access Application Block” in EntLib. I find some codes:
public static class MapBuilder<TResult> where TResult : new()
{
//...
}
I don’t understand about meaning of declaring of this class when using “where TResult : new()“. I think this is new feature in .NET Framework to declare a class. Please give me a document or link to explain about this feature. Thanks.
It’s a generic type parameter constraint. It’s been around since the introduction of generics, in .net 2.0.
Constraints on Type Parameters (MSDN)
The particular constraint you’ve mentioned means only a class with a public parameterless constructor can be used as the type
TResult.See also: Generics (MSDN)