当前位置: 首页>>代码示例>>C#>>正文


C# TypeBase.AddMember方法代码示例

本文整理汇总了C#中TypeBase.AddMember方法的典型用法代码示例。如果您正苦于以下问题:C# TypeBase.AddMember方法的具体用法?C# TypeBase.AddMember怎么用?C# TypeBase.AddMember使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TypeBase的用法示例。


在下文中一共展示了TypeBase.AddMember方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoadNestedTypesOfType

 void LoadNestedTypesOfType(
   TypeBase moduleType
 ) {
   uint currentClassRowId = moduleType.TypeDefRowId;
   uint numberOfNestedClassRows = this.PEFileReader.NestedClassTable.NumberOfRows;
   var moduleTypeArray = this.ModuleTypeDefArray;
   uint firstNestedClassRow = 0;
   uint nestedClassCounter = 0;
   for (uint i = 1; i <= numberOfNestedClassRows; ++i) {
     NestedClassRow nestedClassRow = this.PEFileReader.NestedClassTable[i];
     if (nestedClassRow.EnclosingClass != currentClassRowId) continue;
     if (firstNestedClassRow == 0) firstNestedClassRow = i;
     nestedClassCounter++;
     //  Check if its already created by someone else
     NestedType/*?*/ currType = moduleTypeArray[nestedClassRow.NestedClass] as NestedType;
     if (currType == null) {
       currType = this.CreateModuleNestedType(nestedClassRow.NestedClass, this.PEFileReader.TypeDefTable[nestedClassRow.NestedClass], moduleType);
       var redirectedType = this.ModuleReader.metadataReaderHost.Redirect(this.Module, currType);
       if (redirectedType == currType) moduleType.AddMember(currType);
       moduleTypeArray[nestedClassRow.NestedClass] = currType;
       this.RedirectedTypeDefArray[nestedClassRow.NestedClass] = redirectedType;
       this.ModuleTypeDefLoadState[nestedClassRow.NestedClass] = LoadState.Loaded;
     }
   }
   if (nestedClassCounter > 0) {
     var nestedTypes = new INestedTypeDefinition[nestedClassCounter];
     uint j = 0;
     for (uint i = firstNestedClassRow; j < nestedClassCounter && i <= numberOfNestedClassRows; ++i) {
       NestedClassRow nestedClassRow = this.PEFileReader.NestedClassTable[i];
       if (nestedClassRow.EnclosingClass != currentClassRowId) continue;
       nestedTypes[j++] = (INestedTypeDefinition)moduleTypeArray[nestedClassRow.NestedClass];
       Contract.Assume(nestedTypes[j-1] != null);
     }
     Contract.Assume(j == nestedClassCounter);
     moduleType.nestedTypes = IteratorHelper.GetReadonly(nestedTypes);
   }
 }
开发者ID:Biegal,项目名称:Afterthought,代码行数:37,代码来源:PEFileToObjectModel.cs

示例2: CreateEvent

 EventDefinition CreateEvent(
   uint eventDefRowId,
   TypeBase parentModuleType
 ) {
   Debug.Assert(eventDefRowId > 0 && eventDefRowId <= this.PEFileReader.EventTable.NumberOfRows);
   EventRow eventRow = this.PEFileReader.EventTable[eventDefRowId];
   IName eventName = this.GetNameFromOffset(eventRow.Name);
   EventDefinition moduleEvent = new EventDefinition(this, eventName, parentModuleType, eventDefRowId, eventRow.Flags);
   parentModuleType.AddMember(moduleEvent);
   return moduleEvent;
 }
开发者ID:Biegal,项目名称:Afterthought,代码行数:11,代码来源:PEFileToObjectModel.cs

示例3: CreateProperty

 PropertyDefinition CreateProperty(
   uint propertyDefRowId,
   TypeBase parentModuleType
 ) {
   Debug.Assert(propertyDefRowId > 0 && propertyDefRowId <= this.PEFileReader.PropertyTable.NumberOfRows);
   PropertyRow propertyRow = this.PEFileReader.PropertyTable[propertyDefRowId];
   IName propertyName = this.GetNameFromOffset(propertyRow.Name);
   PropertyDefinition moduleProperty = new PropertyDefinition(this, propertyName, parentModuleType, propertyDefRowId, propertyRow.Flags);
   parentModuleType.AddMember(moduleProperty);
   return moduleProperty;
 }
开发者ID:Biegal,项目名称:Afterthought,代码行数:11,代码来源:PEFileToObjectModel.cs

示例4: CreateMethod

 IMethodDefinition CreateMethod(
   uint methodDefRowId,
   TypeBase parentModuleType
 ) {
   Debug.Assert(methodDefRowId > 0 && methodDefRowId <= this.PEFileReader.MethodTable.NumberOfRows);
   MethodRow methodRow = this.PEFileReader.MethodTable[methodDefRowId];
   IName methodName = this.GetNameFromOffset(methodRow.Name);
   if ((methodRow.Flags & MethodFlags.AccessMask) == MethodFlags.CompilerControlledAccess) {
     //Methods that are compiler controlled access are excempted from duplicate checking and may thus have names that cause
     //their intern keys to clash with other methods. Avoid this by mangling the names of such methods.
     //compiler controlled methods are always referred to via their tokens, so this renaming is safe to do.
     methodName = NameTable.GetNameFor(methodName.Value+"$PST"+((int)TableIndices.Method+methodDefRowId));
   }
   uint genericParamRowIdStart;
   uint genericParamRowIdEnd;
   this.GetGenericParamInfoForMethod(methodDefRowId, out genericParamRowIdStart, out genericParamRowIdEnd);
   IMethodDefinition moduleMethod;
   if (genericParamRowIdStart == 0) {
     moduleMethod = new NonGenericMethod(this, methodName, parentModuleType, methodDefRowId, methodRow.Flags, methodRow.ImplFlags);
   } else {
     moduleMethod = new GenericMethod(this, methodName, parentModuleType, methodDefRowId, methodRow.Flags, methodRow.ImplFlags, genericParamRowIdStart, genericParamRowIdEnd);
   }
   if (methodName.UniqueKey != this.ModuleReader._Deleted_.UniqueKey) {
     moduleMethod = this.ModuleReader.metadataReaderHost.Rewrite(this.Module, moduleMethod);
     parentModuleType.AddMember(moduleMethod);
   }
   return moduleMethod;
 }
开发者ID:Biegal,项目名称:Afterthought,代码行数:28,代码来源:PEFileToObjectModel.cs

示例5: CreateField

 FieldDefinition CreateField(
   uint fieldDefRowId,
   TypeBase parentModuleType
 ) {
   Debug.Assert(fieldDefRowId > 0 && fieldDefRowId <= this.PEFileReader.FieldTable.NumberOfRows);
   FieldRow fieldRow = this.PEFileReader.FieldTable[fieldDefRowId];
   IName fieldName = this.GetNameFromOffset(fieldRow.Name);
   if ((fieldRow.Flags & FieldFlags.AccessMask) == FieldFlags.CompilerControlledAccess) {
     //Methods that are compiler controlled access are excempted from duplicate checking and may thus have names that cause
     //their intern keys to clash with other methods. Avoid this by mangling the names of such methods.
     //compiler controlled methods are always referred to via their tokens, so this renaming is safe to do.
     fieldName = NameTable.GetNameFor(fieldName.Value+"$PST"+((int)TableIndices.Field+fieldDefRowId));
   }
   FieldDefinition moduleField = new FieldDefinition(this, fieldName, parentModuleType, fieldDefRowId, fieldRow.Flags);
   if (fieldName.UniqueKey != this.ModuleReader._Deleted_.UniqueKey) {
     parentModuleType.AddMember(moduleField);
   }
   return moduleField;
 }
开发者ID:Biegal,项目名称:Afterthought,代码行数:19,代码来源:PEFileToObjectModel.cs

示例6: CreateMethod

 MethodDefinition CreateMethod(
   uint methodDefRowId,
   TypeBase parentModuleType
 ) {
   Debug.Assert(methodDefRowId > 0 && methodDefRowId <= this.PEFileReader.MethodTable.NumberOfRows);
   MethodRow methodRow = this.PEFileReader.MethodTable[methodDefRowId];
   IName methodName = this.GetNameFromOffset(methodRow.Name);
   uint genericParamRowIdStart;
   uint genericParamRowIdEnd;
   this.GetGenericParamInfoForMethod(methodDefRowId, out genericParamRowIdStart, out genericParamRowIdEnd);
   MethodDefinition moduleMethod;
   if (genericParamRowIdStart == 0) {
     moduleMethod = new NonGenericMethod(this, methodName, parentModuleType, methodDefRowId, methodRow.Flags, methodRow.ImplFlags);
   } else {
     moduleMethod = new GenericMethod(this, methodName, parentModuleType, methodDefRowId, methodRow.Flags, methodRow.ImplFlags, genericParamRowIdStart, genericParamRowIdEnd);
   }
   if (methodName.UniqueKey != this.ModuleReader._Deleted_.UniqueKey) {
     parentModuleType.AddMember(moduleMethod);
   }
   return moduleMethod;
 }
开发者ID:modulexcite,项目名称:IL2JS,代码行数:21,代码来源:PEFileToObjectModel.cs

示例7: CreateField

 FieldDefinition CreateField(
   uint fieldDefRowId,
   TypeBase parentModuleType
 ) {
   Debug.Assert(fieldDefRowId > 0 && fieldDefRowId <= this.PEFileReader.FieldTable.NumberOfRows);
   FieldRow fieldRow = this.PEFileReader.FieldTable[fieldDefRowId];
   IName fieldName = this.GetNameFromOffset(fieldRow.Name);
   FieldDefinition moduleField = new FieldDefinition(this, fieldName, parentModuleType, fieldDefRowId, fieldRow.Flags);
   if (fieldName.UniqueKey != this.ModuleReader._Deleted_.UniqueKey) {
     parentModuleType.AddMember(moduleField);
   }
   return moduleField;
 }
开发者ID:modulexcite,项目名称:IL2JS,代码行数:13,代码来源:PEFileToObjectModel.cs

示例8: CreateModuleNestedType

 NestedType CreateModuleNestedType(
   uint typeDefRowId,
   TypeDefRow typeDefRow,
   TypeBase parentModuleType
 ) {
   IName typeName = this.GetNameFromOffset(typeDefRow.Name);
   if (typeDefRow.Namespace != 0) {
     IName namespaceName = this.GetNameFromOffset(typeDefRow.Namespace);
     typeName = this.NameTable.GetNameFor(namespaceName.Value+"."+typeName.Value);
   }
   uint genericParamRowIdStart;
   uint genericParamRowIdEnd;
   this.GetGenericParamInfoForType(typeDefRowId, out genericParamRowIdStart, out genericParamRowIdEnd);
   NestedType type;
   if (genericParamRowIdStart == 0) {
     type = new NonGenericNestedType(this, typeName, typeDefRowId, typeDefRow.Flags, parentModuleType);
   } else {
     IName unmangledTypeName = this.GetUnmangledNameFromOffset(typeDefRow.Name);
     type = new GenericNestedType(this, unmangledTypeName, typeDefRowId, typeDefRow.Flags, parentModuleType, typeName, genericParamRowIdStart, genericParamRowIdEnd);
   }
   parentModuleType.AddMember(type);
   return type;
 }
开发者ID:modulexcite,项目名称:IL2JS,代码行数:23,代码来源:PEFileToObjectModel.cs


注:本文中的TypeBase.AddMember方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。