示例#1
0
 /// <summary>
 /// Returns an object instance to serve as the next object in the prototype chain.
 /// </summary>
 /// <param name="engine"> The associated script engine. </param>
 /// <param name="instance"> The CLR object instance to wrap. </param>
 /// <returns> The next object in the prototype chain. </returns>
 private static ObjectInstance GetPrototypeObject(ScriptEngine engine, object instance)
 {
     if (engine == null)
     {
         throw new ArgumentNullException("engine");
     }
     if (instance == null)
     {
         throw new ArgumentNullException("instance");
     }
     return(ClrInstanceTypeWrapper.FromCache(engine, instance.GetType()));
 }
 /// <summary>
 /// Returns an object instance to serve as the next object in the prototype chain.
 /// </summary>
 /// <param name="engine"> The associated script engine. </param>
 /// <param name="type"> The CLR type to wrap. </param>
 /// <returns> The next object in the prototype chain. </returns>
 private static ObjectInstance GetPrototypeObject(ScriptEngine engine, Type type)
 {
     if (engine == null)
     {
         throw new ArgumentNullException("engine");
     }
     if (type == null)
     {
         throw new ArgumentNullException("type");
     }
     if (type.BaseType == null)
     {
         return(null);
     }
     return(ClrInstanceTypeWrapper.FromCache(engine, type.BaseType));
 }