Mercurial > hg > ucis.core
changeset 56:7c15c12ef965
Added new ArrayUtil.ToArray functions
author | Ivo Smits <Ivo@UCIS.nl> |
---|---|
date | Wed, 09 Oct 2013 13:56:35 +0200 |
parents | ec222fb577dd |
children | 4e1a5dec786a |
files | Util/ArrayUtil.cs |
diffstat | 1 files changed, 11 insertions(+), 0 deletions(-) [+] |
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);