Manejo del Result a traves de Linq, Contains, List y validacion

PHOTO EMBED

Sun Jan 07 2024 03:51:33 GMT+0000 (Coordinated Universal Time)

Saved by @javicinhio #cs

List<DataRow> result = new List<DataRow>();

/*
	result = (from x in dt.AsEnumerable() where 
    (x.Field<string>("Code").ToLower().Contains(Value) || 
     x.Field<string>("Description").ToLower().Contains(Value)) && 
    (x.Field<bool>("Active") == true)
     select x).ToList();
*/

result = (from x in dt.AsEnumerable() where x.Field<bool>("Active") == true select x).ToList();

if (result.Count >= 1)
{
  dt = result.CopyToDataTable();
  Bridge.InPut.Code = dt.Rows[0]["Code"].ToString().Trim();
  Bridge.InPut.Description = dt.Rows[0]["Description"].ToString().Trim();
  return;
}
content_copyCOPY