Oktatás * Programozás 2 * Szkriptnyelvek * levelezősök Félévek Linkek * kalendárium |
CSharp /
20180403dstring.Joincsharp> var li = new List<string> {"aa", "bb", "cc", "dd"} csharp> string.Join("", li) "aabbccdd" csharp> string.Join(",", li) "aa,bb,cc,dd" csharp> string.Join("--", li) "aa--bb--cc--dd" csharp> var li = new List<int> {1, 2, 3, 4} csharp> string.Join("", li) // works with numbers too "1234" It also works with numbers, for instance. No need to convert the numbers to strings first. string.ConcatIf you simply want to concatenate the elements, then you can also use csharp> var li = new List<string> {"aa", "bb", "cc", "dd"} csharp> string.Concat(li) "aabbccdd" csharp> var li = new List<int> {1, 2, 3, 4} csharp> string.Concat(li) // works with numbers too "1234" It also works with numbers. |
Blogjaim, hobbi projektjeim * The Ubuntu Incident [ edit ] |