Passing an IDisposable object by reference causes an error?
I am trying to create a general method for disposing an object that implements IDisposable , called DisposeObject() To make sure I am disposing an object pointed by original reference, I am trying to pass an object by reference. But I am getting a compilation error that says The 'ref' argument type doesn't match parameter type In the below (simplified) code, both _Baz and _Bar implement IDisposable . So the questions are, Why am I getting this error? Is there a way to get around it? [UPDATE] From provided answers so far, as long as I do not set an IDisposable argument to null, I can simply