LIKE operator in LINQ

前端 未结 14 1022
一生所求
一生所求 2020-11-27 16:29

Is there any way to compare strings in a C# LINQ expression similar to SQL\'s LIKE operator?

Suppose I have a string list. On this list I want to search

14条回答
  •  有刺的猬
    2020-11-27 16:50

    List categoriess;
            private void Buscar()
            {
                try
                {
                    categoriess = Contexto.Categories.ToList();
                    categoriess = categoriess.Where(n => n.CategoryID >= Convert.ToInt32(txtCatID.Text) && n.CategoryID <= Convert.ToInt32(txtCatID1.Text) && (n.CategoryName.Contains(txtCatName.Text)) ).ToList();
    

提交回复
热议问题