本文整理汇总了C#中Mono.Cecil.MethodDefinition.IsPropertyMethod方法的典型用法代码示例。如果您正苦于以下问题:C# MethodDefinition.IsPropertyMethod方法的具体用法?C# MethodDefinition.IsPropertyMethod怎么用?C# MethodDefinition.IsPropertyMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Cecil.MethodDefinition
的用法示例。
在下文中一共展示了MethodDefinition.IsPropertyMethod方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPropertyNameByMethod
public static string GetPropertyNameByMethod(MethodDefinition method)
{
if (!method.IsPropertyMethod())
throw new ArgumentException("Not a property method", "method");
return method.Name.Substring (4);
}
示例2: IsApplicableElementTarget
private static bool IsApplicableElementTarget(AspectDeclaration aspect, MethodDefinition method)
{
var elemetTargets = aspect.ElementTargets;
if (elemetTargets == ElementTargets.Default)
return true;
bool isCCtor = method.IsStatic && method.IsConstructor;
bool isCtor = !method.IsStatic && method.IsConstructor;
bool isProperty = method.IsPropertyMethod();
if ((elemetTargets & ElementTargets.StaticConstructor) == ElementTargets.StaticConstructor && isCCtor)
return true;
if ((elemetTargets & ElementTargets.InstanceConstructor) == ElementTargets.InstanceConstructor && isCtor)
return true;
if ((elemetTargets & ElementTargets.Property) == ElementTargets.Property && isProperty)
return true;
if ((elemetTargets & ElementTargets.Method) == ElementTargets.Method && !(isCtor || isCCtor || isProperty))
return true;
return false;
}
示例3: IsApplicableMemberTarget
private static bool IsApplicableMemberTarget(AspectDeclaration aspect, MethodDefinition method)
{
if (String.IsNullOrEmpty (aspect.MemberTargets))
return true;
var re = BuildRegexFromSearchPattern (aspect.MemberTargets);
if (method.IsPropertyMethod())
return re.IsMatch (method.Name) || re.IsMatch (TypeTools.GetPropertyNameByMethod (method));
return re.IsMatch (method.Name);
}