I am currently working on a program and need to use the .Replace() method to remove a certain substring from a string. However, the code just doesn't seem to be working.
Below is the code I am using:
if (filter.Contains("AND [Type]"))
{
String test = "AND [Type] = '" + type + "'";
filter.Replace(test, "");
}
else if (filter.Contains("Type") == true)
{
String test = "[Type] = '" + type + "'";
filter.Replace(test, "");
}
I have debugged the code and when stepping through it String test is set to exactly what is contained within the filter - however the code just runs through attempts the replace method but leaves the filter unchanged.
Is there any other way I can attempt to get this working or do I need to take a few steps back and come up with another idea for getting this working?