本文整理汇总了C#中dnlib.DotNet.PropertyDef类的典型用法代码示例。如果您正苦于以下问题:C# PropertyDef类的具体用法?C# PropertyDef怎么用?C# PropertyDef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PropertyDef类属于dnlib.DotNet命名空间,在下文中一共展示了PropertyDef类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindBaseProperties
/// <summary>
/// Finds all properties from base types overridden or hidden by the specified property.
/// </summary>
/// <param name="property">The property which overrides or hides properties from base types.</param>
/// <returns>Properties overriden or hidden by the specified property.</returns>
public static IEnumerable<PropertyDef> FindBaseProperties(PropertyDef property)
{
if (property == null)
yield break;
var accMeth = property.GetMethod ?? property.SetMethod;
if (accMeth != null && accMeth.HasOverrides)
yield break;
bool isIndexer = property.IsIndexer();
foreach (var baseType in BaseTypes(property.DeclaringType)) {
var baseTypeDef = baseType.Resolve();
if (baseTypeDef == null)
continue;
foreach (var baseProperty in baseTypeDef.Properties) {
if (MatchProperty(baseProperty, Resolve(baseProperty.PropertySig, baseType), property)
&& IsVisibleFromDerived(baseProperty, property.DeclaringType)) {
if (isIndexer != baseProperty.IsIndexer())
continue;
yield return baseProperty;
var anyPropertyAccessor = baseProperty.GetMethod ?? baseProperty.SetMethod;
if (anyPropertyAccessor != null && anyPropertyAccessor.IsNewSlot == anyPropertyAccessor.IsVirtual)
yield break;
}
}
}
}
示例2: InterfacePropertyImplementedByNode
public InterfacePropertyImplementedByNode(PropertyDef analyzedProperty) {
if (analyzedProperty == null)
throw new ArgumentNullException(nameof(analyzedProperty));
this.analyzedProperty = analyzedProperty;
analyzedMethod = this.analyzedProperty.GetMethod ?? this.analyzedProperty.SetMethod;
}
示例3: AnalyzedInterfacePropertyImplementedByTreeNode
public AnalyzedInterfacePropertyImplementedByTreeNode(PropertyDef analyzedProperty) {
if (analyzedProperty == null)
throw new ArgumentNullException("analyzedProperty");
this.analyzedProperty = analyzedProperty;
this.analyzedMethod = this.analyzedProperty.GetMethod ?? this.analyzedProperty.SetMethod;
}
示例4: PropertyNode
public PropertyNode(PropertyDef analyzedProperty, bool hidesParent = false) {
if (analyzedProperty == null)
throw new ArgumentNullException(nameof(analyzedProperty));
isIndexer = analyzedProperty.IsIndexer();
this.analyzedProperty = analyzedProperty;
this.hidesParent = hidesParent;
}
示例5: AnalyzedPropertyOverridesTreeNode
public AnalyzedPropertyOverridesTreeNode(PropertyDef analyzedProperty)
{
if (analyzedProperty == null)
throw new ArgumentNullException("analyzedProperty");
this.analyzedProperty = analyzedProperty;
}
示例6: DeletedPropertyUpdater
public DeletedPropertyUpdater(ModuleDocumentNode modNode, PropertyDef originalProperty) {
ownerNode = modNode.Context.DocumentTreeView.FindNode(originalProperty);
if (ownerNode == null)
throw new InvalidOperationException();
parentNode = ownerNode.TreeNode.Parent.Data;
ownerType = originalProperty.DeclaringType;
property = originalProperty;
}
示例7: AnalyzedPropertyTreeNode
public AnalyzedPropertyTreeNode(PropertyDef analyzedProperty, bool hidesParent = false) {
if (analyzedProperty == null)
throw new ArgumentNullException("analyzedProperty");
this.isIndexer = analyzedProperty.IsIndexer();
this.analyzedProperty = analyzedProperty;
this.hidesParent = hidesParent;
this.LazyLoading = true;
}
示例8: EditedPropertyUpdater
public EditedPropertyUpdater(ModuleDocumentNode modNode, PropertyDef originalProperty, PropertyDefOptions propertyDefOptions) {
ownerNode = modNode.Context.DocumentTreeView.FindNode(originalProperty);
if (ownerNode == null)
throw new InvalidOperationException();
property = originalProperty;
originalPropertyDefOptions = new PropertyDefOptions(originalProperty);
newPropertyDefOptions = propertyDefOptions;
}
示例9: GetMethodsAndSelf
public static IEnumerable<IMemberDef> GetMethodsAndSelf(PropertyDef p) {
yield return p;
foreach (var m in p.GetMethods)
yield return m;
foreach (var m in p.SetMethods)
yield return m;
foreach (var m in p.OtherMethods)
yield return m;
}
示例10: AnalyzedPropertyTreeNode
public AnalyzedPropertyTreeNode(PropertyDef analyzedProperty, string prefix = "")
{
if (analyzedProperty == null)
throw new ArgumentNullException("analyzedProperty");
this.isIndexer = analyzedProperty.IsIndexer();
this.analyzedProperty = analyzedProperty;
this.prefix = prefix;
this.LazyLoading = true;
}
示例11: Write
public static ITextOutput Write(ITextOutput output, PropertyDef property, Language language, bool? isIndexer = null) {
language.FormatPropertyName(output, property, isIndexer);
output.WriteSpace();
output.Write(':', TextTokenType.Operator);
output.WriteSpace();
language.TypeToString(output, property.PropertySig.GetRetType().ToTypeDefOrRef(), false, property);
property.MDToken.WriteSuffixString(output);
return output;
}
示例12: PropertyDefOptions
public PropertyDefOptions(PropertyDef prop) {
Attributes = prop.Attributes;
Name = prop.Name;
PropertySig = prop.PropertySig;
Constant = prop.Constant;
GetMethods.AddRange(prop.GetMethods);
SetMethods.AddRange(prop.SetMethods);
OtherMethods.AddRange(prop.OtherMethods);
CustomAttributes.AddRange(prop.CustomAttributes);
}
示例13: PropertyDefOptions
public PropertyDefOptions(PropertyDef prop) {
this.Attributes = prop.Attributes;
this.Name = prop.Name;
this.PropertySig = prop.PropertySig;
this.Constant = prop.Constant;
this.GetMethods.AddRange(prop.GetMethods);
this.SetMethods.AddRange(prop.SetMethods);
this.OtherMethods.AddRange(prop.OtherMethods);
this.CustomAttributes.AddRange(prop.CustomAttributes);
}
示例14: PropertyEquals
public bool PropertyEquals(PropertyDef pd, PropertyInfo pi)
{
if (!MemberEquals(pd, pi) || TypeEquals(pd.PropertySig.RetType, pi.PropertyType) || (int)pd.Attributes != (int)pi.Attributes)
return false;
var gm = pi.GetGetMethod();
var sm = pi.GetSetMethod();
if (gm == null ^ pd.GetMethod == null) return false;
if (sm == null ^ pd.SetMethod == null) return false;
return (gm == null || MethodEquals(pd.GetMethod, gm))
&& (sm == null || MethodEquals(pd.SetMethod, sm));
}
示例15: CopyTo
public PropertyDef CopyTo(PropertyDef prop) {
prop.Attributes = this.Attributes;
prop.Name = this.Name ?? UTF8String.Empty;
prop.PropertySig = this.PropertySig;
prop.Constant = this.Constant;
prop.GetMethods.Clear();
prop.GetMethods.AddRange(this.GetMethods);
prop.SetMethods.Clear();
prop.SetMethods.AddRange(this.SetMethods);
prop.OtherMethods.Clear();
prop.OtherMethods.AddRange(this.OtherMethods);
prop.CustomAttributes.Clear();
prop.CustomAttributes.AddRange(CustomAttributes);
return prop;
}