unreferenced var in using bug?

I have a class called WaitIndicator that implements IDisposable. The regular
usage of that class is:

using (WaitIndicator wait = new WaitIndicator())
{
// Do something that takes a long time here... But don't call anything
on 'wait'
}

Resharper tells me that wait is never used with is kind of true. It is never
explicitly used, but the using statement generates a call to Dispose on it.

Is this a bug? If not, could it maybe be an option?

Thanks,


2 comments
Comment actions Permalink

Resharper is right, you don't need the variable. Try it this way:

using (new WaitIndicator())
{
// Do something that takes a long time here... But don't call anything
on 'wait'
}


"Jeff Lewis" <jeff@consultutah.com> wrote in message
news:3177220632482991730597750@news.jetbrains.com...
>I have a class called WaitIndicator that implements IDisposable. The
>regular usage of that class is:
>

using (WaitIndicator wait = new WaitIndicator())
{
// Do something that takes a long time here... But don't call anything
on 'wait'
}

>

Resharper tells me that wait is never used with is kind of true. It is
never explicitly used, but the using statement generates a call to Dispose
on it.

>

Is this a bug? If not, could it maybe be an option?

>

Thanks,

>



0
Comment actions Permalink

Thank you...

You learn something new everyday...


0

Please sign in to leave a comment.