Simple code blocks on one line?

Hi,

Are there any options in ReSharper to force simple, single-line code blocks
onto the same line as the declaration or statement to which they are
attached when performing a code-reformat etc? For instance, is there anyway
to get:

if (foo == null) {throw new ArgumentNullException("foo");}

(I like to includes the braces for conformity even though not strictly
necessary.)

ReSharper always seems to split this onto three or four lines (depending on
its settings). I can get it to remove the braces for single-line blocks such
as these but even then it leaves the line-break (I have 'Keep existing line
breaks' unchecked).

-dan


1 comment
Comment actions Permalink

Hello Dan,

These two options are missing in ReSharper. They will be added in version
2.0.

Hi,

Are there any options in ReSharper to force simple, single-line code
blocks onto the same line as the declaration or statement to which
they are attached when performing a code-reformat etc? For instance,
is there anyway to get:

if (foo == null) {throw new ArgumentNullException("foo");}

(I like to includes the braces for conformity even though not strictly
necessary.)

ReSharper always seems to split this onto three or four lines
(depending on its settings). I can get it to remove the braces for
single-line blocks such as these but even then it leaves the
line-break (I have 'Keep existing line breaks' unchecked).

-dan

Thanks,
Andrey Simanovsky


0

Please sign in to leave a comment.