ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button
  Implementing Custom Data Bindable Classes: IList
Subject:   Error in implementation of ICollection.CopyTo() method??
Date:   2010-03-02 03:20:04
From:   Stephen L
Hi there, still being somewhat of a newbie I recognized the implementation of the ICollection.CopyTo interface as wrong:

CopyTo takes two (2) arguments:
* Array array (the TARGET)
* int index

In the VS2008 related help section the Integer "index" is supposed to point on the TARGET "array" and not on "this"-collection. It is supposed to copy the whole "this" collection to the TARGET-"array", starting to overwrite the TARGET-"array" at position "index".

In the example in the text the integer "index" is used for getting the first item of the "this"-collection and copying all "this"-items from offset "index".

I could be wrong, so let me know. Also this article is from 2003-09-02 and quite old, but I'm giving it a try.

- Stephen