问题
(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
回答1:
If you place this line directly above the unassigned new, you can disable the warning once.
// ReSharper disable once ObjectCreationAsStatement
来源:https://stackoverflow.com/questions/51838070/how-to-ignore-unassigned-new-in-resharper