How to initialize a Visual Studio format dictionary?

All Visual Studios (2012, too) do not format the following:

_messageProcessor = new Dictionary<ServerDataTypes, MessageProcessor>()
{
    {ServerDataTypes.FrameData,       ProcessFrameData  }   ,
    {    ServerDataTypes.ServerStatusResult,ProcessServerStatusResult     },
    {   ServerDataTypes.PlayerMessage,    ProcessPlayerMessage},
    ....
};

How can I make my Visual Studio 2010 (or 2012) automatic setup? I need the following result:

_messageProcessor = new Dictionary<ServerDataTypes, MessageProcessor>()
{
    { ServerDataTypes.FrameData, ProcessFrameData },
    { ServerDataTypes.ServerStatusResult, ProcessServerStatusResult },
    { ServerDataTypes.PlayerMessage, ProcessPlayerMessage },
     ...
};

This is similar to auto-properties for newly created objects. The format works for this. But not for that. So how to fix this?

+5
source share
1 answer

Short answer: you cannot use VS outside the box. Resharper is approaching, but reformatting does not quite make this style. I really sent a request for him to do this.

You can find some other extension or maybe create some kind of macro.

+6
source

All Articles