Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/313.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 有没有办法按以下格式拆分列表:';string1'';string2'';string3';,_C#_Sql_Split_Filtering_Where In - Fatal编程技术网

C# 有没有办法按以下格式拆分列表:';string1'';string2'';string3';,

C# 有没有办法按以下格式拆分列表:';string1'';string2'';string3';,,c#,sql,split,filtering,where-in,C#,Sql,Split,Filtering,Where In,我需要对我现有的XtraReport执行一个过滤器,我只想看到一些我有ID的特定记录 当我执行以下代码时,它被成功应用 XtraReportOrder report = new XtraReportOrder(); report.FilterString = "orderId IN ('11092', '11093')"; report.ShowPreviewDialog(); 我想用这样的东西 report.FilterString = "orderId IN

我需要对我现有的XtraReport执行一个过滤器,我只想看到一些我有ID的特定记录

当我执行以下代码时,它被成功应用

XtraReportOrder report = new XtraReportOrder();
report.FilterString = "orderId IN ('11092', '11093')";
report.ShowPreviewDialog();
我想用这样的东西

report.FilterString = "orderId IN ("+MyList.ToConvertSthConvinient+")";

您可以结合使用
String.Join
、LINQ和字符串插值功能:

report.FilterString = $"orderId IN ({String.Join(", ", MyList.Select(id => $"'{id}'"))})";
我会考虑使用