implement ToString for IEnumerable

This commit is contained in:
Michael Becker 2022-03-17 14:26:25 -04:00
parent 460250b7ad
commit 6d1aae1600
No known key found for this signature in database
GPG Key ID: 98C333A81F18C22C

View File

@ -20,6 +20,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
using System; using System;
using System.Collections; using System.Collections;
using System.Text;
namespace MBS.Framework.Collections namespace MBS.Framework.Collections
{ {
@ -57,5 +58,16 @@ namespace MBS.Framework.Collections
dest.Add(o); dest.Add(o);
} }
} }
public static string ToString(this IEnumerable source, string separator)
{
StringBuilder sb = new StringBuilder();
foreach (object o in source)
{
sb.Append(o);
sb.Append(separator);
}
return sb.ToString();
}
} }
} }