本文整理匯總了C#中Mono.Cecil.MethodReference.IsProperty方法的典型用法代碼示例。如果您正苦於以下問題:C# MethodReference.IsProperty方法的具體用法?C# MethodReference.IsProperty怎麽用?C# MethodReference.IsProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Mono.Cecil.MethodReference
的用法示例。
在下文中一共展示了MethodReference.IsProperty方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: MatchesAnyParameter
static bool MatchesAnyParameter (MethodReference method, string operand)
{
if (operand == null)
return false;
// for most getter and setter the property name is used
if (method.IsProperty ()) {
if (String.Compare (method.Name, 4, operand, 0, operand.Length, StringComparison.Ordinal) == 0)
return true;
// but we continue looking for parameters (e.g. indexers) unless it's the generic 'value' string
if (operand == "value")
return false;
}
// note: we already know there are Parameters for this method is we got here
foreach (ParameterDefinition parameter in method.Parameters) {
if (parameter.Name == operand)
return true;
}
return false;
}
示例2: DoesReturnDisposable
static bool DoesReturnDisposable (MethodReference call)
{
//ignore properties (likely not the place where the IDisposable is *created*)
MethodDefinition method = call.Resolve ();
if ((method == null) || call.IsProperty ())
return false;
if (method.IsConstructor) {
if (method.DeclaringType.IsGeneratedCode ())
return false; //eg. generators
return method.DeclaringType.Implements ("System", "IDisposable");
}
return method.ReturnType.Implements ("System", "IDisposable");
}