views:

131

answers:

2

I need to change this to be a suggestion and not a warning, but I cannot find the setting to do so.

Where is it?

This is the code that needs to pass (not a compilier warning). It is saying that transaction is a local variable that is not used, but this is valid.

using (TransactionScope transaction = new TransactionScope())
{
    // ...
}
+1  A: 

I don't think ReSharper lets you turn things into a suggestion that will result in a compiler warning or error. I believe this is by design.

Dan Rigby
updated with an example of what is being flagged as a warning, is this a bug with R#?
Jon Erickson
Ilya is correct. In your example, the variable isn't needed at all, using(new TransactionScope()) is sufficient.
Dan Rigby
+4  A: 

If you don't need transaction variable, you can replace it with using (new TransactionScope()) { }

Ilya Ryzhenkov

related questions