https://bugzilla.novell.com/show_bug.cgi?id=415195


           Summary: New Rule: Prefer constant over variable
           Product: Mono: Tools
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Gendarme
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]
         QAContact: [email protected]
          Found By: ---


Here is the idea. For code like this it would be very helpful to report
suggestion about turning a field into constant.

class C
{
 static BindingFlags b = BindingFlags.Public | BindingFlags.NonPublic;

 static void Foo ()
 {
    BindingFlags b2 = b | BindingFlags.IgnoreCase;
 }
}


Basically anytime when a primitive type or enum are read only they can be
turned into a constant. There are some exceptions but I generally this should
be quite easy to implement ;-)

I think this rule can apply to both class/struct fields and local variables.


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to