Formatting code into a single line using ReSharper

c#, code-formatting, resharper

Solution

Use Line Breaks and Wrapping → Preserve Existing Formatting → Keep existing line breaks.

Problem

I am having an issue with formatting code with 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)); ``` This formatting is also undesirable.

Original source