26 авг. 2010 г. · Is there a function in C# to quickly convert some collection to string and separate values with delimiter? |
12 февр. 2011 г. · String.Join(" ", myList) or String.Join(" ", myList.ToArray()) . The first argument is the separator between the substrings. |
29 июн. 2010 г. · The code should be List<string> optionList = new List<string> { "string1", "string2", ..., "stringN"}; ie no trailing () after the list. |
17 окт. 2013 г. · Try this List<string> stringlist = objectList.Cast<string>() .ToList(); If you're not certain about those elements are strings you can use Select. |
17 нояб. 2012 г. · You can join your array using the following: string.Join(",", Client); Then you can output anyway you want. You can change the comma to what ever you want. |
13 окт. 2013 г. · Try this code: var list = new List<string> {"12", "13", "14"}; var result = string.Join(",", list); Console.WriteLine(result); The result is: "12,13,14" |
16 февр. 2013 г. · Use the string.Join method, eg var joined = string.Join(",", users.Select(u => u.Name)); This would give you a single string of user's names separated by ','. |
16 февр. 2011 г. · List<string> result = names.Split(new char[] { ',' }).ToList();. Or even cleaner by Dan's suggestion: List<string> result = names. |
23 дек. 2010 г. · You can do it with a ConvertAll and an anonymous method. Like this: var list = new List<int>(); .... var array = list.ConvertAll( x => x.ToString() ).ToArray(); |
14 янв. 2014 г. · Try this: string SalesManCode = string.Join(",", SelectedSalesmen .Select(x=>string.Format("'{0}'",x))); it will wrap all your elements with ' and then join ... |
Novbeti > |
Axtarisha Qayit Anarim.Az Anarim.Az Sayt Rehberliyi ile Elaqe Saytdan Istifade Qaydalari Anarim.Az 2004-2023 |