本文整理汇总了C#中Namespace.AddMember方法的典型用法代码示例。如果您正苦于以下问题:C# Namespace.AddMember方法的具体用法?C# Namespace.AddMember怎么用?C# Namespace.AddMember使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Namespace
的用法示例。
在下文中一共展示了Namespace.AddMember方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadTypesInNamespace
// Caller must take lock on this
internal void LoadTypesInNamespace(
Namespace moduleNamespace
)
//^ requires moduleNamespace.NamespaceNameOffset != 0xFFFFFFFF;
{
CoreTypes dummy = this.CoreTypes; //force core types to be initialized
uint namespaceNameOffset = moduleNamespace.NamespaceNameOffset;
Debug.Assert(namespaceNameOffset != 0xFFFFFFFF);
uint numberOfTypeDefs = this.PEFileReader.TypeDefTable.NumberOfRows;
var moduleTypeArray = this.ModuleTypeDefArray;
for (uint i = 1; i <= numberOfTypeDefs; ++i) {
TypeDefRow typeDefRow = this.PEFileReader.TypeDefTable[i];
// Check if its in the same namespace
if (typeDefRow.Namespace != namespaceNameOffset || typeDefRow.IsNested)
continue;
// Check if its already created by someone else
NamespaceType/*?*/ type = (NamespaceType)moduleTypeArray[i];
if (type == null) {
type = this.CreateModuleNamespaceType(i, typeDefRow, moduleNamespace, MetadataReaderSignatureTypeCode.NotModulePrimitive);
var redirectedType = this.ModuleReader.metadataReaderHost.Redirect(this.Module, type);
if (redirectedType == type) moduleNamespace.AddMember(type);
moduleTypeArray[i] = type;
this.RedirectedTypeDefArray[i] = redirectedType;
this.ModuleTypeDefLoadState[i] = LoadState.Loaded;
}
}
uint numberOfExportedTypes = this.PEFileReader.ExportedTypeTable.NumberOfRows;
ExportedTypeAliasBase/*?*/[] exportedTypeArray = this.ExportedTypeArray;
for (uint i = 1; i <= numberOfExportedTypes; ++i) {
ExportedTypeRow exportedTypeRow = this.PEFileReader.ExportedTypeTable[i];
// Check if its in the same namespace
if (exportedTypeRow.TypeNamespace != namespaceNameOffset || exportedTypeRow.IsNested)
continue;
// Check if its already created by someone else
ExportedTypeAliasBase/*?*/ type = exportedTypeArray[i];
if (type == null) {
type = this.CreateExportedNamespaceType(i, exportedTypeRow, moduleNamespace);
this.ExportedTypeArray[i] = type;
this.ExportedTypeLoadState[i] = LoadState.Loaded;
}
}
}
示例2: CreateModuleNamespaceType
NamespaceType CreateModuleNamespaceType(
uint typeDefRowId,
TypeDefRow typeDefRow,
Namespace moduleNamespace,
ModuleSignatureTypeCode signatureTypeCode
) {
IName typeName = this.GetNameFromOffset(typeDefRow.Name);
uint genericParamRowIdStart;
uint genericParamRowIdEnd;
this.GetGenericParamInfoForType(typeDefRowId, out genericParamRowIdStart, out genericParamRowIdEnd);
NamespaceType type;
if (genericParamRowIdStart == 0) {
if (signatureTypeCode == ModuleSignatureTypeCode.NotModulePrimitive)
type = new NonGenericNamespaceTypeWithoutPrimitiveType(this, typeName, typeDefRowId, typeDefRow.Flags, moduleNamespace);
else
type = new NonGenericNamespaceTypeWithPrimitiveType(this, typeName, typeDefRowId, typeDefRow.Flags, moduleNamespace, signatureTypeCode);
} else {
IName unmangledTypeName = this.GetUnmangledNameFromOffset(typeDefRow.Name);
type = new GenericNamespaceType(this, unmangledTypeName, typeDefRowId, typeDefRow.Flags, moduleNamespace, typeName, genericParamRowIdStart, genericParamRowIdEnd);
}
moduleNamespace.AddMember(type);
return type;
}
示例3: CreateExportedNamespaceType
ExportedTypeNamespaceAlias CreateExportedNamespaceType(
uint exportedTypeRowId,
ExportedTypeRow exportedTypeRow,
Namespace moduleNamespace
) {
IName typeName = this.GetNameFromOffset(exportedTypeRow.TypeName);
ExportedTypeNamespaceAlias exportedType = new ExportedTypeNamespaceAlias(this, typeName, exportedTypeRowId, exportedTypeRow.Flags, moduleNamespace);
moduleNamespace.AddMember(exportedType);
return exportedType;
}
示例4: CreateExportedNamespaceType
ExportedTypeNamespaceAlias CreateExportedNamespaceType(uint exportedTypeRowId, ExportedTypeRow exportedTypeRow, Namespace moduleNamespace) {
ExportedTypeNamespaceAlias exportedType = new ExportedTypeNamespaceAlias(this, exportedTypeRowId, exportedTypeRow.Flags, moduleNamespace);
moduleNamespace.AddMember(exportedType);
return exportedType;
}