I'm replacing one code with another in each line that the code is found. But the replace simply does not work, it goes through it and the line continues the same way. As you can see in the image below, if used within the immediate, it appears to have worked, but when checking the contents of the string I verified that it continued the same way.
stringtexto=string.Empty;intcontadorCodigos=0;intcontadorLinhas=0;stringlinha=string.Empty;string[]linhas=newstring[_linhas.Count()];foreach(stringlinein_linhas){linha=line;foreach(varitemin_codigos){if(line.Contains(item.Key)){linha.Replace(item.Key,item.Value);//line.Replace(item.Key,item.Value);texto+=$" {item.Key} - {item.Value};";
contadorCodigos++;
break;
}
}
linhas[contadorLinhas] = linha;
contadorLinhas++;
}
txtResultado.Text = texto;
txtQtdCodigosTrocados.Text = contadorCodigos.ToString();
Does anyone know what might be happening?