C# 当我要求ReSharper将get展平时,将其设置为一行,这通常不会';我不能全部做。有人知道为什么吗?
从以下代码开始,我使用ReSharper整理代码:C# 当我要求ReSharper将get展平时,将其设置为一行,这通常不会';我不能全部做。有人知道为什么吗?,c#,.net,resharper,C#,.net,Resharper,从以下代码开始,我使用ReSharper整理代码: public static readonly BindableProperty TestProperty = BindableProperty.Create(nameof(Test), typeof(string), typeof(BaseGrid), default(string)); public string Test { get => (string)GetValue(Tes
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将可绑定属性移动到文件的顶部,并订购我想要的所有内容。但是它将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) 属性声明设置为:“行尾无空格)”
是否还有其他人遇到过同样的问题?我怀疑是“换行”设置,可能是您的建筑红线超过了最大行长(我认为默认为120个字符)
表示相关选项在Alt-R中,O然后使用代码编辑| C#|格式样式|换行和换行上的“右页边距(列)首选项”
请注意,我不使用R#R,因此请随意编辑此答案中的任何不准确之处结果行长度超过X个字符?“TapCommandParamProperty”比“TestProperty”长很多。把“TapCommandParamProperty”缩短一点,看看发生了什么谢谢,你解开了这个谜。我缩短了名字,它起了作用。您是否愿意补充这一点作为答案,以便我们可以帮助其他人解决同样的问题。还有关于如何更改最小线长度的想法吗?