小编Tod*_*son的帖子

如何在长行返回关键字后停止Resharper的换行?

当我使用Resharper CTRL + ALT + SHIFT + F自动格式化超过最大行长度的行(在我的情况下说它是80个字符)时,我得到以下内容:

    return
        View(new ViewModel
        {
            Identifier = identifier,
            Files = service.AllFiles()
        });
Run Code Online (Sandbox Code Playgroud)

但我真正想要的是不要在"return"关键字之后换行(即在一行中没有自己的return关键字),如下所示:

    return View(new ViewModel
    {
        Identifier = identifier,
        Files = service.AllFiles()
    });
Run Code Online (Sandbox Code Playgroud)

有谁知道如何"配置"Resharper来实现这一目标?:)

这是另一个例子,这是我现在看到的:

    return
        repository.Session.CreateCriteria(typeof(SomeType))
                  .Add(Expression.Eq("Identifier", identifier))
                  .UniqueResult<SomeType>();
Run Code Online (Sandbox Code Playgroud)

当我真的想看到:

    return repository.Session.CreateCriteria(typeof(SomeType))
                     .Add(Expression.Eq("Identifier", identifier))
                     .UniqueResult<SomeType>();
Run Code Online (Sandbox Code Playgroud)

更新:

这里是"总是剁":

    return View(new OrganisationFileLoadViewModel
    {
        Identifier = identifier,
        AllExistingOrganisationFiles = nmdsOrganisationFileLoadService.AllNMDSOrganisationFiles()
    });
Run Code Online (Sandbox Code Playgroud)

这是"剁长":

    return
        View(new OrganisationFileLoadViewModel
        {
            Identifier = identifier,
            AllExistingOrganisationFiles = nmdsOrganisationFileLoadService.AllNMDSOrganisationFiles()
        });
Run Code Online (Sandbox Code Playgroud)

c# resharper resharper-8.0

30
推荐指数
1
解决办法
9826
查看次数

T4MVC"运行自定义工具"生成EnvDTO 7.0 vs 8.0 csc警告

当我右键单击T4MVC.tt并选择"运行自定义工具"(即通过T4MVC.cs文件重建)时,我收到以下警告.

警告1个编译转型:假设集引用"EnvDTE,版本= 7.0.3300.0,文化=中性公钥= b03f5f7f11d50a3a"匹配"EnvDTE,版本= 8.0.0.0,文化=中性公钥= b03f5f7f11d50a3a",你可能需要提供运行时策略C:\ Development\EHealth-Trunk\src\EHealth.Web\T4MVC.tt 1 1

这真的没什么大不了的,我只是不喜欢在我的代码库中有(不必要的)警告......

asp.net-mvc envdte t4mvc asp.net-mvc-3

11
推荐指数
1
解决办法
1427
查看次数

Resharper C#格式化样式在切断长行时在新行上显示"新"而不是相同的行

因此Resharper在我的代码中的"new"之前放置一个换行符,重新格式化如下:

var foo = new Foo
{
    Bar = null,
    Baz =
        new Baz
        {
            Bap = null,
            Bork = null,
            Help =
                new PweaseHelp
                {
                    Korben = null,
                    Dallas = null,
                    Multipass = null
                },
            Me =
                new ClearlyMyAbilityToUnderstandResharperSettingsIs(
                    null),
        }
};
Run Code Online (Sandbox Code Playgroud)

但我真的很喜欢这样做:

var foo = new Foo
{
    Bar = null,
    Baz = new Baz
    {
        Bap = null,
        Bork = null,
        Help = new PweaseHelp
        {
            Korben = null,
            Dallas = null,
            Multipass = null
        },
        Me …
Run Code Online (Sandbox Code Playgroud)

c# resharper code-formatting

8
推荐指数
1
解决办法
1014
查看次数