Explinations

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xenoix
    New Member
    • Mar 2009
    • 15

    Explinations

    Hey there people,

    I was wondering if someone could explain to me the differences between static, public/private, abstract etc And when/why would you use them?

    Thanks :)
  • cloud255
    Recognized Expert Contributor
    • Jun 2008
    • 427

    #2
    Hi,

    I suggest take a look at this MSDN entry, it provides explanations for all the C# modifiers. Feel free to post if any of these explanations do not clarify the purpose of any given modifier.

    Comment

    • xenoix
      New Member
      • Mar 2009
      • 15

      #3
      Thanks for that. Will take a read. Just one other question.. why does everytrhing have m_ infront of it?

      m_foobar.someth ing(); Is there some sort of standard/convention of using the m? Does it actually stand anything..

      I guess it's better then adding "i" like everything else :P

      Comment

      • GaryTexmo
        Recognized Expert Top Contributor
        • Jul 2009
        • 1501

        #4
        Yep, you've got it :) That's a convention a lot of people do to signify a member variable. Others leave off the m and just do an _ character.

        By the way, the i usually stands for integer... that's another convention (one that I don't like myself) that people do in order to let them know the data type of the variable by it's name.

        Some examples...

        Code:
        bool bMyBool = true;
        double dVelocity = 9.81;
        List<string> lstrNames = new List<string>();
        And so on...

        Personally, I'm not a fan of it since it can make your variable names a jumble and you do have to take some liberties in the name of variables with complex types. If you code C# in Visual Studio (which I do and assume most others do as well), it's pretty easy to find the type quickly where you need to anyways.

        Comment

        • cloud255
          Recognized Expert Contributor
          • Jun 2008
          • 427

          #5
          If you are lucky enough to be using Team Foundation Server (its very expensive), the code analysis enforces MS naming conventions, so you can run the analysis if you are ever uncertain about naming a variable, class, function or pretty much anything...

          Comment

          Working...