Inheritance: System.Reflection.MethodInfo
Exemplo n.º 1
0
 public static VirtualPropertyInfo Create(string name,
                                          Type declaringType,
                                          Type reflectedType,
                                          Type propertyType,
                                          PropertyAttributes attributes,
                                          bool readable,
                                          bool writable)
 {
     return
         (internalizedCache.GetOrAdd(
              GetUniqueKey(declaringType, reflectedType, propertyType, readable, writable, name, attributes),
              key =>
     {
         VirtualMethodInfo getterBaseDefinition = null;
         VirtualPropertyInfo baseProperty = null;
         if (declaringType != reflectedType)
         {
             baseProperty = Create(name, declaringType, declaringType, propertyType, attributes, readable,
                                   writable);
             getterBaseDefinition = baseProperty.getMethod;
         }
         const MethodAttributes methodAttributes =
             MethodAttributes.NewSlot | MethodAttributes.SpecialName |
             MethodAttributes.HideBySig
             | MethodAttributes.Virtual | MethodAttributes.Public;
         var getter = new VirtualMethodInfo("get_" + name, declaringType, reflectedType, methodAttributes,
                                            baseDefinition: getterBaseDefinition);
         var prop = new VirtualPropertyInfo(name, declaringType, reflectedType, propertyType, getter,
                                            null, attributes, baseProperty);
         return prop;
     }));
 }
Exemplo n.º 2
0
 internal VirtualPropertyInfo(string name,
                              Type declaringType,
                              Type reflectedType,
                              Type propertyType,
                              VirtualMethodInfo getMethod,
                              VirtualMethodInfo setMethod,
                              PropertyAttributes attributes,
                              VirtualPropertyInfo baseDefinition)
 {
     if (declaringType == null)
         throw new ArgumentNullException(nameof(declaringType));
     if (reflectedType == null)
         throw new ArgumentNullException(nameof(reflectedType));
     if (propertyType == null)
         throw new ArgumentNullException(nameof(propertyType));
     if (name == null)
         throw new ArgumentNullException(nameof(name));
     DeclaringType = declaringType;
     ReflectedType = reflectedType;
     PropertyType = propertyType;
     this.getMethod = getMethod;
     this.setMethod = setMethod;
     Name = name;
     Attributes = attributes;
     BaseDefinition = baseDefinition ?? this;
     MetadataToken = VirtualMemberMetadataTokenAllocator.AllocateToken();
 }
Exemplo n.º 3
0
 internal VirtualPropertyInfo(string name,
                              Type declaringType,
                              Type reflectedType,
                              Type propertyType,
                              VirtualMethodInfo getMethod,
                              VirtualMethodInfo setMethod,
                              PropertyAttributes attributes,
                              VirtualPropertyInfo baseDefinition)
 {
     if (declaringType == null)
     {
         throw new ArgumentNullException(nameof(declaringType));
     }
     if (reflectedType == null)
     {
         throw new ArgumentNullException(nameof(reflectedType));
     }
     if (propertyType == null)
     {
         throw new ArgumentNullException(nameof(propertyType));
     }
     if (name == null)
     {
         throw new ArgumentNullException(nameof(name));
     }
     DeclaringType  = declaringType;
     ReflectedType  = reflectedType;
     PropertyType   = propertyType;
     this.getMethod = getMethod;
     this.setMethod = setMethod;
     Name           = name;
     Attributes     = attributes;
     BaseDefinition = baseDefinition ?? this;
     MetadataToken  = VirtualMemberMetadataTokenAllocator.AllocateToken();
 }
Exemplo n.º 4
0
 public static VirtualPropertyInfo Create(string name,
                                          Type declaringType,
                                          Type reflectedType,
                                          Type propertyType,
                                          PropertyAttributes attributes,
                                          bool readable,
                                          bool writable)
 {
     return
         internalizedCache.GetOrAdd(
             GetUniqueKey(declaringType, reflectedType, propertyType, readable, writable, name, attributes),
             key =>
             {
                 VirtualMethodInfo getterBaseDefinition = null;
                 VirtualPropertyInfo baseProperty = null;
                 if (declaringType != reflectedType)
                 {
                     baseProperty = Create(name, declaringType, declaringType, propertyType, attributes, readable,
                                           writable);
                     getterBaseDefinition = baseProperty.getMethod;
                 }
                 const MethodAttributes methodAttributes =
                     MethodAttributes.NewSlot | MethodAttributes.SpecialName |
                     MethodAttributes.HideBySig
                     | MethodAttributes.Virtual | MethodAttributes.Public;
                 var getter = new VirtualMethodInfo("get_" + name, declaringType, reflectedType, methodAttributes,
                                                    baseDefinition : getterBaseDefinition);
                 var prop = new VirtualPropertyInfo(name, declaringType, reflectedType, propertyType, getter,
                                                    null, attributes, baseProperty);
                 return prop;
             });
 }