Mercurial > hg > ucis.core
diff Util/ArrayUtil.cs @ 56:7c15c12ef965
Added new ArrayUtil.ToArray functions
author | Ivo Smits <Ivo@UCIS.nl> |
---|---|
date | Wed, 09 Oct 2013 13:56:35 +0200 |
parents | f553f6e0a396 |
children | 4714531734b3 |
line wrap: on
line diff
--- a/Util/ArrayUtil.cs Wed Oct 02 21:34:09 2013 +0200 +++ b/Util/ArrayUtil.cs Wed Oct 09 13:56:35 2013 +0200 @@ -1,4 +1,5 @@ using System; +using System.Collections; using System.Collections.Generic; namespace UCIS.Util { @@ -14,6 +15,16 @@ Array.Copy(input, offset, output, 0, count); return output; } + public static Object[] ToArray(ICollection input) { + Object[] output = new Object[input.Count]; + input.CopyTo(output, 0); + return output; + } + public static T[] ToArray<T>(ICollection input) { + T[] output = new T[input.Count]; + input.CopyTo(output, 0); + return output; + } public static T[] ToArray<T>(ICollection<T> input) { T[] output = new T[input.Count]; input.CopyTo(output, 0);