Skip to content

Instantly share code, notes, and snippets.

@jurrchen
Created August 13, 2010 21:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jurrchen/523581 to your computer and use it in GitHub Desktop.
Save jurrchen/523581 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace clojure.lang
{
public class GenGeneric
{
public static object Create(Type genclass,PersistentVector gentypes,PersistentVector argv)
{
Type[] cleantypes = new Type[gentypes.Count];
gentypes.CopyTo(cleantypes,0);
if (argv.Count > 0)
{
object[] cleanargv = new object[argv.Count];
argv.CopyTo(cleanargv, 0);
return Activator.CreateInstance(genclass.MakeGenericType(cleantypes), cleanargv);
}
else
{
return Activator.CreateInstance(genclass.MakeGenericType(cleantypes));
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment