What's the benefits of using the method which is using “new()” over the one not using “new()” with where clause in the method in c#?
There are two methods which does the same task. The only difference in them is one has "new()" and other does not have.
The methods are:
Method 1:
public void Method1<T>(BaseReportContent content) where T : BaseReportContent, new()
{
//Codes
}
Method 2:
public void Method2<T>(BaseReportContent content) where T : BaseReportContent
{
//Codes
}
What is the benefits of using one over another?
Comments
Post a Comment