implement ToString for IEnumerable
This commit is contained in:
parent
460250b7ad
commit
6d1aae1600
@ -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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user