Quote (Kalei @ Dec 9 2012 01:50pm)
Lenght return the lenght of the array. I could compare that to sizeof(array)/sizeof(array_type) in C++
you sure. msds claims
Quote
Length Gets the number of characters in the current String object.
and
Quote
Count<Char>() Overloaded. Returns the number of elements in a sequence. (Defined by Enumerable.)
i believe you would have to use .Count in order to get a random value to use as an element to return beecause .Length returns the number of characters inside the current element.
ex:
text[0] = "hai"
text[1] = " bai"
text.Length() would return 3
and text.Count would return 2
because text (aka text[0]... text is a pointer to the first element of the string array) has 3 characters in it.
where as text.Countt returns the total number of elements in the array.
it might be returnng 1 for every file because of some weird segfault where you are trying to return a string element that doesnt exist.
as in if your function would pick 3 as the random value and try to return text[3]. it would segfault because there is no allocated memory at that address space.
at least i think thats whats happening here
This post was edited by AbDuCt on Dec 9 2012 11:58am