When creating a new type using the object initialiser syntax, Visual Studio automatically moves the braces to align with the type after the new keyword.
Like this
MyType myType = new MyType
{
};
However, I would prefer it not to do this and instead leave it like so
MyType myType = new MyType
{
};
Any ideas how to do this - I've been through all the Visual Studio formatting options and can't find one that is appropriate
Any ideas?
From my most popular answer here:
You will have the style that you want!
You will find this in Resharper options. Go to ReSharper -> Options -> C# -> Formatting Style -> Braces Layout -> "Array And Object Initialization"
. But I am not sure if ReSharper allows such formatting.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.