ReportDocument rptDoc = new ReportDocument(); // ...code to load report... // ...code to display report... rptDoc.Dispose();
using (ReportDocument rptDoc = new ReportDocument()) { // ...code to load report... // ...code to display report... }In this example, the using statement is used to create a ReportDocument object, load and display a report, and automatically dispose of the object once the using block is exited. The ReportDocument.Dispose method is part of the Crystal Reports for .NET Framework package library.