~ubuntu-branches/debian/sid/mono-tools/sid

« back to all changes in this revision

Viewing changes to gendarme/rules/Gendarme.Rules.Performance/PreferLiteralOverInitOnlyFieldsRule.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2010-09-13 09:08:47 UTC
  • mfrom: (14.1.2 experimental)
  • Revision ID: james.westby@ubuntu.com-20100913090847-lhu3z021w2azaj8q
Tags: 2.6.2-3
Upload to Debian Unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
        /// <summary>
42
42
        /// This rule looks for <c>InitOnly</c> fields (<c>readonly</c> in C#) that could be
43
43
        /// turned into <c>Literal</c> (<c>const</c> in C#) because their value is known at
44
 
        /// compile time. <c>Literal</c> fields don't need to be initialized (i.e. they wont
45
 
        /// show up or add a static constructor to the type) resulting in less code and the 
46
 
        /// value (not a reference to the field) will be directly used in the IL (but this
47
 
        /// can be a double-edged sword).
 
44
        /// compile time. <c>Literal</c> fields don't need to be initialized (i.e. they don't
 
45
        /// force the compiler to add a static constructor to the type) resulting in less code and the 
 
46
        /// value (not a reference to the field) will be directly used in the IL (which is OK
 
47
        /// if the field has internal visibility, but is often problematic if the field is visible outside
 
48
        /// the assembly).
48
49
        /// </summary>
49
50
        /// <example>
50
51
        /// Bad example: