[Mono-bugs] [Bug 415195] New: New Rule: Prefer constant over variable
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Wed Aug 6 15:45:09 EDT 2008
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: mono-bugs at lists.ximian.com
ReportedBy: msafar at novell.com
QAContact: mono-bugs at lists.ximian.com
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.
More information about the mono-bugs
mailing list