c#将Resharper格式化代码转换成一行

前端之家收集整理的这篇文章主要介绍了c#将Resharper格式化代码转换成一行前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个与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));

这种格式也是不合需要的.

解决方法

换行和包装>保留现有格式>保留现有换行符?
原文链接:https://www.f2er.com/csharp/92276.html

猜你在找的C#相关文章