Created
December 18, 2014 15:56
-
-
Save kibotu/a5e97b23fc5a0868baa1 to your computer and use it in GitHub Desktop.
IEnumerable ToString with separator extension method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string ToString<T>(this IEnumerable<T> list, string separator) | |
{ | |
StringBuilder sb = new StringBuilder(); | |
foreach (var obj in list) { | |
if (sb.Length > 0) { | |
sb.Append(separator); | |
} | |
sb.Append(obj); | |
} | |
return sb.ToString(); | |
} | |
Debug.Log(list.ToString( ", ")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment