本文整理汇总了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");
}