C# 去开头字符串


//拼sql
// OR ParentId='510326'
string sql2 = "select * from TB_PROJECTS WHERE  ";
string sql3 = "";
projects.ForEach(x =>
{
    sql3 += $" OR ParentId='{x.ProID}'";
});
string strRegex = @"^( OR )";
sql3 = Regex.Replace(sql3, strRegex, "");
sql2 = sql2 + sql3;
List<tb_Projects> list_parents = db.Set<tb_Projects>().SqlQuery(sql2).OrderBy(c => c.ProID).ToList();

原文地址:https://www.cnblogs.com/guxingy/p/13050063.html