Tony Johansson wrote:
> Hello!
>
> The Array class implements these interfaces IClonable, IList, ICollection
> and IEnumerable.
> Note only interfaces are inherited and no classes so these interfaces will
> be implemented in the derived class.
>
> In Interface IList have a couple of members that is not available from the
> Array object.
> For example if I do the following
> int[] vector = new int[5];
> And then use the intellisense on instance vector I can't see for example
> Add, Remove RemoveAt
> there are more but these are just example of members that are not available
> from the vector instance.
>
> So my question is how is this possible?
You need to cast your Array to IList first:
string[] strings = new string[] { "foo", "bar" };
IList stringList = (IList)strings;
Console.WriteLine(stringList.Contains("foo"));
That is because IList is explicitly implemented by Array.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/