I need to loop through an array of strings and know if I've seen a particular string value before. Normally, I would have written something like this in other languages:
String oldValue="";
String newValue;
for (i=0;i<myarray.Length;i++)
{
newValue=myarray[i];
if (oldValue==newValue)
break;
...
oldValue=newValue;
}
However, this doesn't work in C# as Strings are immutable. It looks like I could do this with a Regular Expression if I just replaced the entire string, but that seems like extra overhead. How have other people handled this before?
Thank you
newValue? Obviously this isn't a full program; it wouldn't compile as-is.)