idispose

How to use IDispose on my custom class?

Here is what I have: public void FindByID(string id) { using (Parser parser = new Parser()) { if ( parser.LoadUserById(id)) { ID = parser.FindID(); Name = parser.FindName(); // ... } else { MessageBox.Show("User not found."); } } // end using block. ...

How to implement a funtion that takes a param array (variable number of args) of generic args

I have seen a question here where they implemented a generic dispose method that takes any IDisposable object and calls dispose on it. I would like to make this such that it can take variable number of args. However, I do want to restrict the args to be IDisposable at compile time. (This is because some people in my organization will en...

Disposing of Crystal Reports

Hi all I have a number of report viewers set up, each of which can open a number of crystal reports. This all works fine. I am wanting to streamline how i dispose of the reports in the DisposeOfReports() event. At the minute i do the following: If (_rpt1 IsNot Nothing) Then _rpt1.Close() _rpt1.Dispose() End If If (_rpt2...