public FieldInfo(FieldInfo fieldDef, TypeInfo declaringType) : base(declaringType) { if (fieldDef.Definition == null) { throw new ArgumentException("Argument must be a bare field definition"); } rootDefinition = fieldDef; Name = fieldDef.Name; Attributes = fieldDef.Attributes; fieldTypeReference = TypeRef.FromTypeInfo(fieldDef.FieldType.SubstituteGenericArguments(declaringType.GetGenericArguments())); DefaultValue = fieldDef.DefaultValue; DefaultValueMetadataAddress = fieldDef.DefaultValueMetadataAddress; }
public EventInfo(EventInfo eventDef, TypeInfo declaringType) : base(declaringType) { rootDefinition = eventDef; Name = eventDef.Name; Attributes = eventDef.Attributes; eventTypeReference = TypeRef.FromTypeInfo(eventDef.EventHandlerType.SubstituteGenericArguments(declaringType.GetGenericArguments())); AddMethod = declaringType.GetMethodByDefinition(eventDef.AddMethod); RemoveMethod = declaringType.GetMethodByDefinition(eventDef.RemoveMethod); RaiseMethod = declaringType.GetMethodByDefinition(eventDef.RaiseMethod); }