private static readonly Dictionary<int, LocalizationLanguage> _languages = new Dictionary<int, LocalizationLanguage>() {
{0,new LocalizationLanguage { CultureInfo = "en-US", Id = 0 }},
{1,new LocalizationLanguage { CultureInfo = "es-AR", Id = 1 }}
};
I have this declaration, and it doesn’t autowrap into something nice, whereas if I do the exact same but with a property accessor, it formats perfectly to:
private static Dictionary<int, LocalizationLanguage> _languages
{
get
{
return new Dictionary<int, LocalizationLanguage>()
{
{0, new LocalizationLanguage {CultureInfo = "en-US", Id = 0}},
{1, new LocalizationLanguage {CultureInfo = "es-AR", Id = 1}}
};
}
}
What’s the reason for this and how can I make either vs2010 or R# auto-format this kind of expressions?
I’ve just tested this myself, as I use vs2010 and R# myself. It automatically reformats the code to:
vs2010 reformats the code upon completion of the statement (entering the
;). I tested by pasting your unformatted code into visual studio, and erasing the final};. Typing it again automatically formats it. I also tested having different variations of the original code before closing the statement and it formats it the same no matter what.I would guess there is an issue with your vs2010 or R# in this case?