I'm designing a class capable of deserializing some file, and I'm wondering what would be the implications of this two options:
// option 1 - generic class
public class XmlConfigurationManager<T>
{
public T ReadConfigurationAndWriteDefault(string configurationPath, Func<T> defaultConfiguration)
{
...
}
public T Deserialize(string configurationPath)
{
...
}
}
// option 2 - generic methods in non generic class
public class XmlConfigurationManager
{
public T ReadConfigurationAndWriteDefault<T>(string configurationPath, Func<T> defaultConfiguration)
{
...
}
public T Deserialize<T>(string configurationPath)
{
...
}
}
I can't seem to find any hint on the differences between the two.
How do this two options compare? There would be any difference? Are there any notable points to keep in mind when evaluating the design?
ReadConfigurationAndWriteDefault
entry point. I'm mainly interested in JIT differences, performance (I don't expect this to be a thing) or design considerations.