Proper disposing of MD5CryptoServiceProvider

Posted by StupidDeveloper on Stack Overflow See other posts from Stack Overflow or by StupidDeveloper
Published on 2010-04-23T09:37:24Z Indexed on 2010/04/23 9:43 UTC
Read the original article Hit count: 213

Filed under:
|

Which one of the below 2 code pieces is not calling dispose and therefore is bad practice:

...
using(MD5CryptoServiceProvider p = new MD5CryptoServiceProvider())
{
  return p.ComputeHash(...);
}
...

or

...
return new MD5CryptoServiceProvider()).ComputeHash(...);    
...

?

© Stack Overflow or respective owner

Related posts about c#

Related posts about dispose