Im am using serialization and deserialisation to read and store settings in a xml file. I have het created a generic class because I want to store different kind of settings in different kind of xml files. Is it possible to instantiate the type of the generic class within that class?
example:
class Example<T>
{
T obj;
public Example()
{
obj = new T();
}
}
static void Main()
{
Example<SomeSettings> example = new Example<SomeSettings>();
}
I know the code above is not working but i hope it explains what i want. I als know i can use a where statement like...
class Example<T> where T : SomeSetting, new()
But this this is not working for me because the generic class is used by multiple types.
Please advise me