Search code examples
c#.net-standard-2.1

Is there a C# function to get all stack elements as a joined string


I have a Stack<string> that I'm processing but sometimes I can't process all elements and would like to join/concatenate the remaining stack elements into one string. Is there an existing function or will I need to pop all elements in a loop and append them to a string variable?


Solution

  • Try using the String.Join function to concatenate a few objects into a single string.