1
How can I define in Linq
the same that I define in clausular Where do sql server
in the form below ..
select * from tb_CentrosCusto cc
where cc.Clasificacao like '1.4.1%'
In other words, I’m just getting what starts with what I’m going through, I’m using the Contains
, but so it checks whether what I’m comparing contains in string
whether it is at the beginning or at the end.
List<Int32> Ids = new List<Int32>();
foreach (var ClasificacaoPai in CCPais)
{
var IdCentroCusto = CentrosCusto
.Where(CC => CC.Clasificacao.Contains(ClasificacaoPai))
.Select(CC => CC.IdCentroCusto)
.ToList();
if (IdCentroCusto.Count > 0)
Ids.AddRange(IdCentroCusto);
}
See how it comes
I just want what starts with 1.4.1
Good... had gone wrong. Valew
– André Monteiro