Ejemplo n.º 1
0
 // Token: 0x060002F5 RID: 757 RVA: 0x000101BC File Offset: 0x0000E3BC
 private MethodInfo SanityCheckCallback(TypeModel model, MethodInfo callback)
 {
     this.metaType.ThrowIfFrozen();
     if (callback == null)
     {
         return(callback);
     }
     if (callback.IsStatic)
     {
         throw new ArgumentException("Callbacks cannot be static", "callback");
     }
     if (callback.ReturnType != model.MapType(typeof(void)) || !CallbackSet.CheckCallbackParameters(model, callback))
     {
         throw CallbackSet.CreateInvalidCallbackSignature(callback);
     }
     return(callback);
 }
 // Token: 0x0600038B RID: 907 RVA: 0x000135D0 File Offset: 0x000117D0
 internal void VerifyFactory(MethodInfo factory, Type type)
 {
     if (factory != null)
     {
         if (type != null && Helpers.IsValueType(type))
         {
             throw new InvalidOperationException();
         }
         if (!factory.IsStatic)
         {
             throw new ArgumentException("A factory-method must be static", "factory");
         }
         if (type != null && factory.ReturnType != type && factory.ReturnType != base.MapType(typeof(object)))
         {
             throw new ArgumentException("The factory-method must return object" + ((type == null) ? "" : (" or " + type.FullName)), "factory");
         }
         if (!CallbackSet.CheckCallbackParameters(this, factory))
         {
             throw new ArgumentException("Invalid factory signature in " + factory.DeclaringType.FullName + "." + factory.Name, "factory");
         }
     }
 }