Original Post
I try to write a content management system for the sake of learning c#
Because it feels right, i tried to make a generic Load() function for my content manager
after some trial and error i found out, i can't instanciate a generic type, and i also can't call static methods of generic types
i googled around and found this solution, it works as i want ... but please tell me what i'm doing here xD
what means the "new()" ?!?!
Because it feels right, i tried to make a generic Load() function for my content manager
after some trial and error i found out, i can't instanciate a generic type, and i also can't call static methods of generic types
i googled around and found this solution, it works as i want ... but please tell me what i'm doing here xD
what means the "new()" ?!?!
public T Load<T>(string name) where T:Resource, new()
{
T resource = new T();
resource.Load(name);
return resource;
}