Given the following example…
public class Example
{
public static T GetDefaultValue<T>()
{
// return ???
}
}
Without using generics, what approach could I use to constrain the type passed in to the GetDefaultValue function to a class with a parameterless constructor that implements IDisposable?
How would I instantiate an instance of the that type to return from the GetDefaultValue function?
I’m confused by what you mean.. but instead of using generics (without generics?) you can constrain the type to an interface.