Can someone explain to me why the top part of the code works but when test is an array it doesn't?
string test = "Customer - ";
if (test.Contains("Customer"))
{
test = "a";
}
The code below doesn't work
string[] test = { "Customer - " };
if (test.Contains("Customer"))
{
test[0] = "a";
}
string
&string[]
- are different, so the.Contains
method for each is a different method, even though it has the same name, and each does a different thing. – Married