I'm trying to search for a string in a string array in C# but I'm not sure how. So, if the array has 50 elements, most of them null, how would I go about searching for a string in the array? For example:
string[] this_array;
this_array = new string[50];
this_array[1] = "One, Two, Three";
this_array[2] = "Foo, Bar, Five";
this_array[3] = null;
How would I go about searching for "Five" in this_array? I understand I have to use a for loop, I'm just not sure of the actual code. I have to find the exact index so I cannot obtain a boolean.
Any help would be much appreciated!
Jamie
Update: Here's my, very incomplete code, so far:
for (array_number = 1; array_number < this_array.Length; array_number++)
{
//no idea what to put here :S
}
forloop? If yes, where exactly are you stuck? :)