public void Create(Type type)
 {
     if (!type.IsArray)
     {
         var constructor = type.GetConstructor(Type.EmptyTypes);
         if (constructor == null)
         {
             throw new InvalidOperationException("Missing parameterless constructor for type '" + type + "'");
         }
         Il.Newobj(constructor);
     }
     else
     {
         var rank = type.GetArrayRank();
         if (rank == 1)
         {
             Il.Ldc_I4(0);
             Il.Newarr(type.GetElementType());
         }
         else
         {
             var constructor = type.GetConstructor(Enumerable.Repeat(typeof(int), rank).ToArray());
             if (constructor == null)
             {
                 throw new InvalidOperationException(string.Format("Missing constructor accepting {0} integers for type '{1}'", rank, type));
             }
             for (int i = 0; i < rank; ++i)
             {
                 Il.Ldc_I4(0);
             }
             Il.Newobj(constructor);
         }
     }
 }