本文介绍了使用ReSharper将代码格式化为一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在使用ReSharper格式化代码时遇到问题。
I am having an issue with formatting code with ReSharper.
我禁用了换行选项。使用此选项,以下代码将被格式化为一行。我如何让ReSharper不格式化以下代码?
I have disabled the option for wrapping lines. With this option, the following code will be formatted to a single line. How can I have ReSharper not format the following code?
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));
如果启用换行,格式化的代码将如下所示:
If I enable line wrapping, the formatted code will come out like this:
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));
这种格式也不可取。
推荐答案
使用换行和换行→ 保留现有格式→ 保留现有的换行符。
Use Line Breaks and Wrapping → Preserve Existing Formatting → Keep existing line breaks.
这篇关于使用ReSharper将代码格式化为一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!