Find an array length without the use of the Array.Length method c# -
i know how go finding length of array without use of array.length method rather array.length method acheive?
i had homework complete arbituary array sorting without use of array.length method , curious how c# finds array length go through array counting each non null value , returns value or there specific memory value associated arrays length can accessed more out of curiosity else wondering goes on behind scenes of length method
this 1 way:
int count = 0; foreach (var item in yourarray) { count++; } count hold how many items there in array.
edit: ofcourse forgot if cant use dreaded length property can use count() method.
Comments
Post a Comment