System.Reflection.CustomAttributeEncodedArgument.ParseAttributeArguments C# (CSharp) Метод

ParseAttributeArguments() статический приватный Метод

static private ParseAttributeArguments ( ConstArray attributeBlob, CustomAttributeCtorParameter &customAttributeCtorParameters, CustomAttributeNamedParameter &customAttributeNamedParameters, Module customAttributeModule ) : void
attributeBlob ConstArray
customAttributeCtorParameters CustomAttributeCtorParameter
customAttributeNamedParameters CustomAttributeNamedParameter
customAttributeModule Module
Результат void
        internal static void ParseAttributeArguments(ConstArray attributeBlob, 
            ref CustomAttributeCtorParameter[] customAttributeCtorParameters,
            ref CustomAttributeNamedParameter[] customAttributeNamedParameters,
            Module customAttributeModule)
        {
            if (customAttributeModule == null)
                throw new ArgumentNullException("customAttributeModule");

            if (customAttributeNamedParameters == null)
                customAttributeNamedParameters = new CustomAttributeNamedParameter[0];

            CustomAttributeCtorParameter[] _customAttributeCtorParameters = customAttributeCtorParameters;
            CustomAttributeNamedParameter[] _customAttributeNamedParameters = customAttributeNamedParameters;

            unsafe 
            {
                ParseAttributeArguments(
                    attributeBlob.Signature, 
                    (int)attributeBlob.Length, 
                    ref _customAttributeCtorParameters, 
                    ref _customAttributeNamedParameters,
                    (IntPtr)customAttributeModule.Assembly.AssemblyHandle.Value);
            }

            customAttributeCtorParameters = _customAttributeCtorParameters;
            customAttributeNamedParameters = _customAttributeNamedParameters;
        }
        #endregion

Same methods

CustomAttributeEncodedArgument::ParseAttributeArguments ( IntPtr pCa, int cCa, CustomAttributeCtorParameter &CustomAttributeCtorParameters, CustomAttributeNamedParameter &CustomAttributeTypedArgument, IntPtr assembly ) : void

Usage Example

Пример #1
0
 private CustomAttributeData(RuntimeModule scope, CustomAttributeRecord caRecord)
 {
     this.m_scope = scope;
     this.m_ctor  = (RuntimeConstructorInfo)RuntimeType.GetMethodBase(scope, caRecord.tkCtor);
     ParameterInfo[] parametersNoCopy = this.m_ctor.GetParametersNoCopy();
     this.m_ctorParams = new CustomAttributeCtorParameter[parametersNoCopy.Length];
     for (int i = 0; i < parametersNoCopy.Length; i++)
     {
         this.m_ctorParams[i] = new CustomAttributeCtorParameter(CustomAttributeData.InitCustomAttributeType((RuntimeType)parametersNoCopy[i].ParameterType));
     }
     FieldInfo[]    fields     = this.m_ctor.DeclaringType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
     PropertyInfo[] properties = this.m_ctor.DeclaringType.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
     this.m_namedParams = new CustomAttributeNamedParameter[properties.Length + fields.Length];
     for (int j = 0; j < fields.Length; j++)
     {
         this.m_namedParams[j] = new CustomAttributeNamedParameter(fields[j].Name, CustomAttributeEncoding.Field, CustomAttributeData.InitCustomAttributeType((RuntimeType)fields[j].FieldType));
     }
     for (int k = 0; k < properties.Length; k++)
     {
         this.m_namedParams[k + fields.Length] = new CustomAttributeNamedParameter(properties[k].Name, CustomAttributeEncoding.Property, CustomAttributeData.InitCustomAttributeType((RuntimeType)properties[k].PropertyType));
     }
     this.m_members = new MemberInfo[fields.Length + properties.Length];
     fields.CopyTo(this.m_members, 0);
     properties.CopyTo(this.m_members, fields.Length);
     CustomAttributeEncodedArgument.ParseAttributeArguments(caRecord.blob, ref this.m_ctorParams, ref this.m_namedParams, this.m_scope);
 }
All Usage Examples Of System.Reflection.CustomAttributeEncodedArgument::ParseAttributeArguments
CustomAttributeEncodedArgument