C # code commonly used techniques

1, when the fight sql statement, list elements in single quotes and separated by commas: string.Join ( ",", list.Select (r => " '" + r + "'"))

2, string str = " '" + r + "',"; list.Trim ( ","); // TrimEnd ( ',') to remove the last comma

3、string[] arr=str.split(',');   string[] arrTest = arr.Distinct().ToArray();

Guess you like

Origin www.cnblogs.com/SunXiaoLin/p/11686260.html