-
Notifications
You must be signed in to change notification settings - Fork 4
Gendarme.Rules.Design.ProvideAlternativeNamesForOperatorOverloadsRule(2.10)
Assembly: Gendarme.Rules.Design
Version: 2.10
The rule ensure that all overloaded operators are also accessible using named alternatives because some languages, like VB.NET, cannot use overloaded operators. For those languages named methods should be implemented that provide the same functionality. This rule verifies that a named alternative exists for each overloaded operator.
-
op_UnaryPlus : Plus
-
op_UnaryNegation : Negate
-
op_LogicalNot : LogicalNot
-
op_OnesComplement : OnesComplement
-
op_Increment : Increment
-
op_Decrement : Decrement
-
op_True : IsTrue
-
op_False : IsFalse
-
op_Addition : Add
-
op_Subtraction : Subtract
-
op_Multiply : Multiply
-
op_Division : Divide
-
op_Modulus : Modulus
-
op_BitwiseAnd : BitwiseAnd
-
op_BitwiseOr : BitwiseOr
-
op_ExclusiveOr : ExclusiveOr
-
op_LeftShift : LeftShift
-
op_RightShift : RightShift
-
op_Equality : Equals
-
op_Inequality : (not) Equals
-
op_GreaterThan : Compare
-
op_LessThan : Compare
-
op_GreaterThanOrEqual : Compare
-
op_LessThanOrEqual : Compare
Bad example:
class DoesNotImplementAlternative {
public static int operator + (DoesNotOverloadOperatorEquals a, DoesNotOverloadOperatorEquals b)
{
return 0;
}
}
Good example:
class DoesImplementAdd {
public static int operator + (DoesImplementAdd a, DoesImplementAdd b)
{
return 0;
}
public int Add (DoesImplementAdd a)
{
return this + a;
}
}
Note that this page was autogenerated (3/17/2011 9:31:58 PM) based on the xmldoc
comments inside the rules source code and cannot be edited from this wiki.
Please report any documentation errors, typos or suggestions to the
Gendarme Mailing List. Thanks!