TTT
TTT

Reputation: 1885

How to ignore unassigned new in ReSharper?

(Using ReSharper Ultimate 2017.1.3.)

In my code I have something like this:

new someClass(null);

It is not assigned to any variable and it should stay like this. (It may look weird but it is used in a specific test case.)

ReSharper warning says:

Possible unassigned object create by 'new' expression

The menu doesn't suggest to auto-write the comment so I'm looking for the syntax.

What is the ReSharper comment to ignore this?

After some search I already tried:

// ReSharper disable once

// ReSharper disable once UnassignedField

// ReSharper disable once UnassignedField.Compiler

Upvotes: 3

Views: 600

Answers (1)

Henrik Wilshusen
Henrik Wilshusen

Reputation: 289

If you place this line directly above the unassigned new, you can disable the warning once.

// ReSharper disable once ObjectCreationAsStatement

Upvotes: 4

Related Questions