If I have a The following is small (and can be considered cleaner): Something looks like this: If you really want to use it as a string, you can call it to IEnumerable , then this is the perfect way to create a toasting method Does the value comma delimit?
var enumOfObjects = myEnumerable as IList & lt; Object & gt; ?? MyEnumerable.Cast & LT; Object & gt; () ToList () .; Var enumOfStrings = enumOfObjects.Select (x = & gt; x.ToString ()); Var final string = string .joined (",", enmofstringings); Or, what a foreach loop would be better? Or is there a cleaner way of doing this?
EnumOfObjects.Aggregate ((a, b) => a + "," + b))
IEnumerable & Lt; Object & gt; EnumOfObjects = New list & lt; Object & gt; {1, "cat", 3, 4}; Console.lightline (enumOfObjects.Agregate ((a, b) = & gt; a + "," + b)); // Output 1, Cat, 3,4
ToString () Or to put it to string.
No comments:
Post a Comment