Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Resharper have special settings for enum?

I'm using Resharper 5.1.1 to reformat my code (Cleanup Code, Ctrl+E, Ctrl+C). I can't get it to format my code the way I want it to. I want my code to look like this:

public class Person
{
    public enum Sex {Male, Female}

    public Sex Gender { get; set; }

    public Person(Sex gender)
    {
        Gender = gender;
    }
}

My problem is with the enum. Since an enum is a type, just as a class is a type, they are treated the same. Therefor, the enum is formatted as

public enum Sex
{
    Male,
    Female
}

The curly braces of the type (i.e. the enum) are placed on a separate line and the members are also placed on a separate line. For a Class that is exactly what I want. But for a (simple) enum I just want them on a single line.

For an auto property there is an exception (Place abstract property/indexer/event declaration on single line), so the auto property is formatted the way I want it to.

Is there an option in Resharper to have it place an enum on a single line?

Update After posting the same question on the Resharper forum, I've been told it currently isn't possible. A Feature Request has been created for it. If you also feel this is an option you'd like to see in a future version of Resharper, please vote for the request.

like image 429
comecme Avatar asked Jan 06 '11 20:01

comecme


1 Answers

Taking a look at the options of ReSharper, I found no option, too.

Maybe if you post the question in the ReSharper forum you can get direct response from their developers or support engineers.

like image 103
Uwe Keim Avatar answered Sep 28 '22 04:09

Uwe Keim