本文整理汇总了C#中Property.GetUpperBound方法的典型用法代码示例。如果您正苦于以下问题:C# Property.GetUpperBound方法的具体用法?C# Property.GetUpperBound怎么用?C# Property.GetUpperBound使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Property
的用法示例。
在下文中一共展示了Property.GetUpperBound方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SharpAssemblyProperty
public SharpAssemblyProperty(SharpAssembly_ asm, Property[] propertyTable, SharpAssemblyClass declaringtype, uint index)
{
if (asm == null) {
throw new System.ArgumentNullException("asm");
}
if (propertyTable == null) {
throw new System.ArgumentNullException("propertyTable");
}
if (declaringtype == null) {
throw new System.ArgumentNullException("declaringType");
}
if (index > propertyTable.GetUpperBound(0) || index < 1) {
throw new System.ArgumentOutOfRangeException("index", index, String.Format("must be between 1 and {0}!", propertyTable.GetUpperBound(0)));
}
AssemblyReader assembly = asm.Reader;
declaringType = declaringtype;
Property property = asm.Tables.Property[index];
string name = assembly.GetStringFromHeap(property.Name);
FullyQualifiedName = String.Concat(declaringType.FullyQualifiedName, ".", name);
MethodSemantics[] sem = (MethodSemantics[])assembly.MetadataTable.Tables[MethodSemantics.TABLE_ID];
Method[] method = (Method[])assembly.MetadataTable.Tables[Method.TABLE_ID];
uint getterMethodIndex = 0; // used later for parameters
if (sem == null) goto nosem;
for (int i = 1; i <= sem.GetUpperBound(0); ++i) {
uint table = sem[i].Association & 1;
uint ident = sem[i].Association >> 1;
if (table == 1 && ident == index) { // table: Property
modifiers = ModifierEnum.None;
Method methodDef = method[sem[i].Method];
if (methodDef.IsFlagSet(Method.FLAG_STATIC)) {
modifiers |= ModifierEnum.Static;
}
if (methodDef.IsFlagSet(Method.FLAG_ABSTRACT)) {
modifiers |= ModifierEnum.Abstract;
}
if (methodDef.IsFlagSet(Method.FLAG_VIRTUAL)) {
modifiers |= ModifierEnum.Virtual;
}
if (methodDef.IsFlagSet(Method.FLAG_FINAL)) {
modifiers |= ModifierEnum.Final;
}
if (methodDef.IsMaskedFlagSet(Method.FLAG_PRIVATE, Method.FLAG_MEMBERACCESSMASK)) { // I assume that private is used most and public last (at least should be)
modifiers |= ModifierEnum.Private;
} else if (methodDef.IsMaskedFlagSet(Method.FLAG_FAMILY, Method.FLAG_MEMBERACCESSMASK)) {
modifiers |= ModifierEnum.Protected;
} else if (methodDef.IsMaskedFlagSet(Method.FLAG_PUBLIC, Method.FLAG_MEMBERACCESSMASK)) {
modifiers |= ModifierEnum.Public;
} else if (methodDef.IsMaskedFlagSet(Method.FLAG_ASSEM, Method.FLAG_MEMBERACCESSMASK)) {
modifiers |= ModifierEnum.Internal;
} else if (methodDef.IsMaskedFlagSet(Method.FLAG_FAMORASSEM, Method.FLAG_MEMBERACCESSMASK)) {
modifiers |= ModifierEnum.ProtectedOrInternal;
} else if (methodDef.IsMaskedFlagSet(Method.FLAG_FAMANDASSEM, Method.FLAG_MEMBERACCESSMASK)) {
modifiers |= ModifierEnum.Protected;
modifiers |= ModifierEnum.Internal;
}
if ((sem[i].Semantics & MethodSemantics.SEM_GETTER) == MethodSemantics.SEM_GETTER) {
getterRegion = new DefaultRegion(0, 0, 0, 0);
getterMethod = new SharpAssemblyMethod(asm, method, declaringtype, sem[i].Method);
getterMethodIndex = sem[i].Method;
}
if ((sem[i].Semantics & MethodSemantics.SEM_SETTER) == MethodSemantics.SEM_SETTER) {
setterRegion = new DefaultRegion(0, 0, 0, 0);
setterMethod = new SharpAssemblyMethod(asm, method, declaringtype, sem[i].Method);
}
}
}
nosem:
// Attributes
ArrayList attrib = asm.Attributes.Property[index] as ArrayList;
if (attrib == null) goto noatt;
AbstractAttributeSection sect = new AbstractAttributeSection();
foreach(SharpCustomAttribute customattribute in attrib) {
sect.Attributes.Add(new SharpAssemblyAttribute(asm, customattribute));
}
attributes.Add(sect);
noatt:
if ((property.Flags & Property.FLAG_SPECIALNAME) == Property.FLAG_SPECIALNAME) modifiers |= ModifierEnum.SpecialName;
//.........这里部分代码省略.........