Type parameter constraints for the liskov principle in C#.NET?

Everything inherits from object... Without the constraint your code should work but you'll need to implement both Clone methods in the same way as IEnumerable/IEnumerable work - . NET doesn't have covariant return types. You should also then specify that your Clone method is hiding the one in ICloneable: public interface ICloneable : ICloneable { new T Clone(); } Note that the current ICloneable interface is somewhat deprecated - because it gives no indication of the depth of cloning, it's not terribly useful in most cases.

Do you really need to extend the non-generic type at all? Do you expect users to want to use the non-generic interface as well as your generic one?

I want an interface so I need to write the Clone()-method only one time. So without rewriting it for System.ICloneable.Clone(). And I only need to implement the ICloneable-interface.

Without writing methods that are hidden by that method. – CommuSoft Jul 15 '09 at 12:16 1 In that case I'd remove any reference to the non-generic interface, and without the constraint you should be fine. – Jon Skeet Jul 15 '09 at 12:17.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions