[Mono-list] System.Array.Contains()?

Kamil Skalski kamil.skalski at gmail.com
Mon Jan 15 10:27:48 EST 2007


You need to cast to IList explicitly, as it is "hidden" interface
implementation:

 string[] x = new string[]{"a", "b"};
 Console.WriteLine(((IList)x).Contains("b"));

(should work, though I didn't test)

2007/1/15, Chris Seaton <chris at chrisseaton.com>:
> System.Array has a Contains() method doesn't it? System.Array
> implements System.Collections.IList and I see the implementation in
> Array.cs, but when I try
>
> string[] x = new string[]{"a", "b"};
> Console.WriteLine(x.Contains("b"));
>
> I get
>
> error CS0117: `string[]' does not contain a definition for `Contains'
>
> What's wrong? Using gmcs with latest mono release.
>
> Thanks
>
> Chris Seaton
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>


-- 
Kamil Skalski
http://nazgul.omega.pl


More information about the Mono-list mailing list