A useful extension method to System.String. Given a comma-seperated list in a string, it'll return a generic List of type string, with each value occupying its own index.
public static List<string> ParseCsvToList(this string source) { var valuesArray = source.Split(new char[] {','}); return valuesArray.Select(value => value.Trim()).ToList(); }
Không có nhận xét nào:
Đăng nhận xét