-3
There is a snippet in my program that looks for a specific string to assign a value to some variable. However I am not able to run these parameters inside the "If"... Debugging goes through this.
//if (valor == "Datasul")
if (valor.Contains("Datasul"))
{
t1.ObsRecurso = model.ObsDatasul;
}
else if (valor.Contains("Protheus"))
{
t1.ObsRecurso = model.ObsProtheus;
}
else
{
t1.ObsRecurso = "";
}
ListaRecursos.Add(t1);
}
I tried to do this search so much with if (valor == "Datasul")
how much valor.Contains("Datasul"))
, but in none of the cases the program enters this conditional.
@EDIT
Tried to use Equals?
– viana
if (valor.Equals("Datasul"))
– viana
Hudson, what is the value of the variable
valor
?– Jéf Bueno
@Viana In C# it makes no difference unless the operator/method is rewritten.
– Jéf Bueno
@LINQ The variable is returning the correct value. I edited the post with an illustrative GIF.
– Hudson Medeiros