gpt4 book ai didi

c# - 使用 ReSharper 将代码格式化为一行

转载 作者:太空狗 更新时间:2023-10-29 17:37:07 27 4
gpt4 key购买 nike

我在使用 ReSharper 格式化代码时遇到问题。

我已禁用换行选项。使用此选项,以下代码将被格式化为单行。如何让 ReSharper 不格式化以下代码?

Mapper.CreateMap<CountryEntity, Country>()
.ForMember(dest => dest.CreatedBy, map => map.MapFrom(src => src.CreatedBy))
.ForMember(dest => dest.DateCreated, map => map.MapFrom(src => src.DateCreated))
.ForMember(dest => dest.Id, map => map.MapFrom(src => src.Id))
.ForMember(dest => dest.Name, map => map.MapFrom(src => src.Name))
.ForMember(dest => dest.CountryCodeChar2, map => map.MapFrom(src => src.CountryCodeChar2))
.ForMember(dest => dest.CountryCodeChar3, map => map.MapFrom(src => src.CountryCodeChar3));

如果我启用换行,格式化后的代码将如下所示:

Mapper.CreateMap<CountryEntity, Country>().ForMember(
dest => dest.CreatedBy, map => map.MapFrom(src => src.CreatedBy)).ForMember(
dest => dest.DateCreated, map => map.MapFrom(src => src.DateCreated)).ForMember(
dest => dest.Id, map => map.MapFrom(src => src.Id)).ForMember(
dest => dest.Name, map => map.MapFrom(src => src.Name)).ForMember(
dest => dest.CountryCodeChar2, map => map.MapFrom(src => src.CountryCodeChar2)).ForMember(
dest => dest.CountryCodeChar3, map => map.MapFrom(src => src.CountryCodeChar3));

这种格式也是不可取的。

最佳答案

使用换行符和换行符保留现有格式保留现有换行符

关于c# - 使用 ReSharper 将代码格式化为一行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8823719/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com