以下函数经常被调用,让我们说每一秒:
/// <summary>
/// Gets a unique identifier string of for the worksheet in the format [WorkbookName]WorksheetName
/// </summary>
/// <param name="workbook">The workbook.</param>
/// <param name="worksheet">The worksheet.</param>
/// <returns>
/// A unique worksheet identifier string, or an empty string.
/// </returns>
public static string GetWorksheetUniqueIdentifier(Workbook workbook, dynamic worksheet)
{
if (workbook == null) return string.Empty;
if (worksheet == null) return string.Empty;//Note: Worksheet can also be a diagram!
return string.Format("[{0}]{1}", workbook.Name, worksheet.Name);
}
Run Code Online (Sandbox Code Playgroud)
过了一会儿,我得到以下异常:
System.OutOfMemoryException
at System.Collections.Generic.Dictionary`2.Resize()
at …Run Code Online (Sandbox Code Playgroud)