예제 #1
0
 /// <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
0
 /// <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;
 }