C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,858 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
see 2 sample code
class DataStore<T> where T : class, new()
{
public T Data { get; set; }
}
class DataStore<T> where T : new()
{
public T Data { get; set; }
}
what is difference between where T : new() and where T : class, new() ? thanks
The answer is here
where (generic type constraint) (C# Reference) and new constraint (C# Reference)