A
Andreas Huber
Hi there
Can anyone imagine a reason why string does not have a default ctor?
Agreed, that might be necessary only very rarely in .NET 1.1 code.
However, in conjunction with .NET 2.0 and generics it is just plain
annoying. Example:
class Param< T > where T : new()
{
public Param()
{
val = new T(); // here
}
// Other members
private T val;
}
Of course I would want to instantiate the Param template with all kinds
of types, e.g. double, int, and - you guessed it - string.
Thanks & Regards,
Can anyone imagine a reason why string does not have a default ctor?
Agreed, that might be necessary only very rarely in .NET 1.1 code.
However, in conjunction with .NET 2.0 and generics it is just plain
annoying. Example:
class Param< T > where T : new()
{
public Param()
{
val = new T(); // here
}
// Other members
private T val;
}
Of course I would want to instantiate the Param template with all kinds
of types, e.g. double, int, and - you guessed it - string.
Thanks & Regards,