Archived

This topic is now archived and is closed to further replies.

thedevdan

C# ArrayList question.

Recommended Posts

Why does it''s Clone() method return an object, instead of an ArrayList? All it does is force me to cast to an ArrayList whenever I use Clone().

Share this post


Link to post
Share on other sites
ArrayList.Clone() is an implementation of the ICloneable interface. And ICloneable.Clone() is defined to return an Object type.

edit: and C# doesn't support covariant return types.

[edited by - SiCrane on May 20, 2004 9:35:28 PM]

Share this post


Link to post
Share on other sites