locked
Why does SuspensionManager not follow property registration conventions?

    Question

  • The SuspensionManager.cs file that is supplied with the Metro style app templates in Visual Studio contains this kind of code:

    private static DependencyProperty FrameSessionStateKeyProperty = DependencyProperty.RegisterAttached("_FrameSessionStateKey", typeof(String), typeof(SuspensionManager), null);
    private static DependencyProperty FrameSessionStateProperty = DependencyProperty.RegisterAttached("_FrameSessionState", typeof(Dictionary<String, Object>), typeof SuspensionManager), null); 

    The Metro style documentation for Attached Properties states that such properties should follow a convention that does not include any mention of prefixing property names with an underscore character. Why is Microsoft's code not following the convention the documentation calls for? Is there some hidden benefit to doing it this way? Or is it just programmer whim?

    Friday, July 13, 2012 11:14 PM

Answers

  • There should be no runtime impact on not following the naming convention, but you might run into FXCop or StyleCop warnings if you have specific rule targeting that.

    Dev@Mic

    Tuesday, July 24, 2012 9:00 PM

All replies

  • Thanks for the feedback. I have communicated this to our Templates team.

    Dev@Mic

    Sunday, July 15, 2012 11:28 PM
  • I see you proposed your comment as an answer. Can I take from that, that there is no hidden benefit or well-thought-out reason behind this?

    If I remember correctly, not naming properties according to conventions can actually cause problems in code execution. That's mainly why I was curious.

    -Oluf

    Monday, July 16, 2012 1:12 AM
  • There should be no runtime impact on not following the naming convention, but you might run into FXCop or StyleCop warnings if you have specific rule targeting that.

    Dev@Mic

    Tuesday, July 24, 2012 9:00 PM
  • Thanks! I would recommend that these templates get updated to follow the official conventions that Microsoft itself puts out there. Anything else just makes it look like the left hand doesn't know what the right hand is doing.
    Tuesday, July 24, 2012 10:18 PM