本文整理匯總了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);
}