wasSharp – Diff between revs 4 and 5

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 4 Rev 5
Line 20... Line 20...
20 /// Converts a list of string to a comma-separated values string. 20 /// Converts a list of string to a comma-separated values string.
21 /// </summary> 21 /// </summary>
22 /// <param name="l">a list of strings</param> 22 /// <param name="l">a list of strings</param>
23 /// <returns>a commma-separated list of values</returns> 23 /// <returns>a commma-separated list of values</returns>
24 /// <remarks>compliant with RFC 4180</remarks> 24 /// <remarks>compliant with RFC 4180</remarks>
25 public static string wasEnumerableToCSV(IEnumerable<string> l) 25 public static string FromEnumerable(IEnumerable<string> l)
26 { 26 {
27 string[] csv = l.Select(o => o).ToArray(); 27 string[] csv = l.Select(o => o).ToArray();
28 char[] escapeCharacters = {'"', ' ', ',', '\r', '\n'}; 28 char[] escapeCharacters = {'"', ' ', ',', '\r', '\n'};
29 Parallel.ForEach(csv.Select((v, i) => new {i, v}), o => 29 Parallel.ForEach(csv.Select((v, i) => new {i, v}), o =>
30 { 30 {
Line 50... Line 50...
50 /// Converts a comma-separated list of values to a list of strings. 50 /// Converts a comma-separated list of values to a list of strings.
51 /// </summary> 51 /// </summary>
52 /// <param name="csv">a comma-separated list of values</param> 52 /// <param name="csv">a comma-separated list of values</param>
53 /// <returns>a list of strings</returns> 53 /// <returns>a list of strings</returns>
54 /// <remarks>compliant with RFC 4180</remarks> 54 /// <remarks>compliant with RFC 4180</remarks>
55 public static IEnumerable<string> wasCSVToEnumerable(string csv) 55 public static IEnumerable<string> ToEnumerable(string csv)
56 { 56 {
57 Stack<char> s = new Stack<char>(); 57 Stack<char> s = new Stack<char>();
58 StringBuilder m = new StringBuilder(); 58 StringBuilder m = new StringBuilder();
59 for (int i = 0; i < csv.Length; ++i) 59 for (int i = 0; i < csv.Length; ++i)
60 { 60 {