Should I call Dispose() within a function after Return?

Posted by Camilo Martin on Stack Overflow See other posts from Stack Overflow or by Camilo Martin
Published on 2010-05-14T09:19:03Z Indexed on 2010/05/14 9:24 UTC
Read the original article Hit count: 296

Filed under:
|
|
|
|

Should I call .Dispose() after returning an object that implements IDisposable?

myDisposableObject Gimme() {
  //Code
  return disposableResult;
  disposableResult.Dispose();
}

In other words, is the object I return a copy, or is it the object itself? Thanks :)

© Stack Overflow or respective owner

Related posts about .NET

Related posts about c#