Page 1 of 1

array count error

Posted: Thu Oct 04, 2012 4:46 pm
by omayer
getting the followin gerror when counting the element in arrray -

Code: Select all

int countArrayElement = GlobalVarClass.errorScnid.Count;
'System.Array' does not contain a definition for 'Count' and no extension method 'Count' accepting a first argument of type 'System.Array' could be found (are you missing a using directive or an assembly reference?) (CS1061) -

Re: array count error

Posted: Thu Oct 04, 2012 4:47 pm
by omayer
problem fixed by adding reference - using System.Collections;

Re: array count error

Posted: Thu Oct 04, 2012 5:01 pm
by omayer
NOT fixed , same error returned after adding system.collections, Thank you in advance

Re: array count error

Posted: Fri Oct 05, 2012 7:52 am
by sdaly
As the error states, the Array type does not contain a member called Count (collections do)... Use Length when dealing with Arrays -

http://msdn.microsoft.com/en-us/library ... array.aspx

Re: array count error

Posted: Wed Oct 10, 2012 9:17 pm
by omayer
thank you sdaly, it worked w/length