当我要求 ReSharper 将我的 get 设置为一行时,它通常不会全部完成。有人知道为什么吗?

When I ask ReSharper to flatten out my get, set to one line it often doesn't do them all. Anyone know why?

从这段代码开始,我使用 ReSharper 来整理我的代码:

    public static readonly BindableProperty TestProperty =
        BindableProperty.Create(nameof(Test), typeof(string), typeof(BaseGrid), default(string));
    public string Test
    {
        get => (string)GetValue(TestProperty);
        set => SetValue(TestProperty, value);
    }
    public static readonly BindableProperty TapCommandProperty =
        BindableProperty.Create(nameof(TapCommand), typeof(Command), typeof(BaseGrid), default(Command));
    public Command TapCommand {
        get => (Command)GetValue(TapCommandProperty);
        set => SetValue(TapCommandProperty, value);
    }

    public static readonly BindableProperty TapCommandParamProperty =
        BindableProperty.Create(nameof(TapCommandParam), typeof(object), typeof(BaseGrid), default(object));
    public object TapCommandParam {
        get => (object)GetValue(TapCommandParamProperty);
        set => SetValue(TapCommandParamProperty, value);
    }

    public static readonly BindableProperty TextProperty =
        BindableProperty.Create(nameof(Text), typeof(string), typeof(BaseGrid), default(string));
    public string Text
    {
        get => (string)GetValue(TextProperty);
        set => SetValue(TextProperty, value);
    }

ReSharper 将 Bindable 属性移动到文件的顶部并排序我想要的所有内容。但它将 get, set 更改为如下所示:

    public Command TapCommand{
        get => (Command) GetValue(TapCommandProperty);
        set => SetValue(TapCommandProperty, value);
    }
    public object TapCommandParam{
        get => GetValue(TapCommandParamProperty);
        set => SetValue(TapCommandParamProperty, value);
    }
    public string Test{ get => (string) GetValue(TestProperty); set => SetValue(TestProperty, value); }
    public string Text{ get => (string) GetValue(TextProperty); set => SetValue(TextProperty, value); }

我的问题是,为什么有时 ReSharper 仅将某些 get, set 展平为一行(这正是我想要的)而其他的不展平?

注:

a) 我正在使用最新版本的 ReSharper、Visual Studio、.net 等。 b) 属性 声明设置为:“在行尾没有 space)”

有没有其他人遇到过同样的问题?

我怀疑这是“长行换行”设置,可能您的 属性 行超过了最大行长度(我认为默认为 120 个字符)

The fine manual 表示相关选项在 Alt-R 中,O 然后在 代码编辑中使用“右边距(列) 首选项| C# | 格式化样式 | 换行和换行"

请注意,我不使用 R#r,因此请随时编辑此答案中的任何不准确之处