Random Post: Design by Contract Part 2
RSS .92| RSS 2.0| ATOM 0.3
  • Home
  • About
  • Eric’s Toolset
  • Free Software
  • Software License
  •  

    Naming Private Fields (Addendum)

    January 30th, 2007 by Eric

    This is just a quick addition to the previous posting, confirming the alleged use of m_ by Microsoft in their own code.

    Lutz Roeder’s .NET Reflector is a fascinating tool for various reasons, including its ability to show all the .NET Framework classes that use prefixes on member variables. There are a bunch. Here is a very small sample of venerable classes that use m_:

    • System.Int32
    • System.String
    • System.Threading.Thread
    • System.Reflection.Assembly
    • System.Environment
    • System.Globalization.CultureInfo
    • System.Net.Connection
    • System.Net.HttpWebRequest
    • System.Net.IPAddress
    • System.Uri
    • System.WeakReference

    And here are a few of the classes that use a leading underscore for field names, though there aren’t as many in this category:

    • System.AppDomain
    • System.Guid
    • System.Console
    • System.Exception
    • System.Collections.ArrayList
    • System.Delegate
    • System.TimeSpan

    One Response to “Naming Private Fields (Addendum)”

    Leave a Reply