How to fix CA2000 code analysis error in following function on statement DataTable dtSummary = new DataTable("Summary");? CA2000 going off If I use using block on dtSummary and I can't use using block in below function becuase some other function is going to use return datatable from GetSummaryReportTable function.
private DataTable GetSummaryReportTable(IImportResult result) {
DataTable dtSummary = new DataTable("Summary");
dtSummary.Columns.Add(STATUS_STRING_COL_NAME, typeof(string));
dtSummary.Columns.Add(STATUS_COL_NAME, typeof(int));
DataRow dataRow;
foreach (ReportErrorLevel error in distinctErrors)
{
dataRow = dtSummary.NewRow();
dataRow[STATUS_STRING_COL_NAME] = error.ToString();
dataRow[STATUS_COL_NAME] = Convert.ToInt16(error);
dtSummary.Rows.Add(dataRow);
}
return dtSummary;
}