本文整理汇总了C#中Mono.Cecil.MethodDefinition.IsOperator方法的典型用法代码示例。如果您正苦于以下问题:C# MethodDefinition.IsOperator方法的具体用法?C# MethodDefinition.IsOperator怎么用?C# MethodDefinition.IsOperator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Cecil.MethodDefinition
的用法示例。
在下文中一共展示了MethodDefinition.IsOperator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetMethodClassification
/// <summary>
/// Gets the method classification for this method.
/// </summary>
/// <param name="method">The method definition.</param>
/// <returns>A method classification.</returns>
public static MethodClassification GetMethodClassification(MethodDefinition method)
{
if (method.IsConstructor)
{
return MethodClassification.Constructor;
}
if (method.IsSpecialName)
{
if (method.IsOperator())
{
return MethodClassification.Operator;
}
if (method.Name.StartsWith("add_"))
{
return MethodClassification.EventAccessor;
}
if (method.Name.StartsWith("remove_"))
{
return MethodClassification.EventAccessor;
}
}
if (method.IsExtensionMethod())
{
return MethodClassification.ExtensionMethod;
}
return MethodClassification.Method;
}
示例2: GetOperatorClassification
/// <summary>
/// Gets the operator classification for the specified method.
/// </summary>
/// <param name="method">The method to get the operator classification for.</param>
/// <returns>The operator classification or <c>null</c> if the specified method wasn't an operator.</returns>
public static OperatorClassification GetOperatorClassification(MethodDefinition method)
{
if (method.IsOperator())
{
if (Operators.ContainsKey(method.Name))
{
return Operators[method.Name];
}
}
return OperatorClassification.Unknown;
}