A
Andy
Hello.
I've got an issue with the ICloneable interface that makes me think I'm
missing the advantages of it.
My issue is that the implemented Clone method returns an object and not
a strongly typed definition. This means that the class you create
exposes a method that returns an object which the user of the class must
cast.
public object Clone() {...}
I would much prefer the class to expose a type of itself:
public MyClass Clone() {...}
so that the caller doesn't have to cast and the interface is cleaner.
Why should I then use IClonable??
Thanks,
Andy
I've got an issue with the ICloneable interface that makes me think I'm
missing the advantages of it.
My issue is that the implemented Clone method returns an object and not
a strongly typed definition. This means that the class you create
exposes a method that returns an object which the user of the class must
cast.
public object Clone() {...}
I would much prefer the class to expose a type of itself:
public MyClass Clone() {...}
so that the caller doesn't have to cast and the interface is cleaner.
Why should I then use IClonable??
Thanks,
Andy