I have the following:
GenericClass<T> : Class
{
T Results {get; protected set;}
public GenericClass<T> (T results, Int32 id) : base (id)
{
Results=results;
}
public static GenericClass<T> Something (Int32 id)
{
return new GenericClass<T> (i need to pass something like new T?, id);
}
}
Update T can be either type or value, so using new() is okish for some types but definetely not for values. I suppose that would imply some class redesign.
the idea was how to use the constructor? eg is it possible to pass something similar to new T (although it should not, because T is not known at the time) or what will to be the twist to avoid passing null?
1 Answer