0
我有一个在Winform应用程序中的日志页面,它显示后台进程并使用DataSet和DataTable将消息排序为消息“队列”。当发现新的进程时,会创建一个新的日志。这工作很好,但我有内存泄漏。我一直在研究切换到“队列”。从DataSet/DataTable迁移到队列
(粗糙的复制/粘贴,由于复杂性和长度)
DataSet dsLogs = new DataSet("Logs");
....
[Message Queue accept new message, the following creates a new tab with an icon to click and watch queue - accept "oLogObject" from message queue]
if (!dsLogs.Tables.Contains(szTableName)) // add table in
{
DataTable dtNew = new DataTable(szTableName);
dtNew.Columns.Add("EventDate", typeof(string));
dtNew.Columns.Add("Function", typeof(string));
dtNew.Columns.Add("IsError", typeof(bool));
dtNew.Columns.Add("LongMessage", typeof(string));
dtNew.Columns.Add("Message", typeof(string));
dtNew.Columns.Add("Process", typeof(string));
dtNew.Columns.Add("RecID", typeof(string));
dtNew.Columns.Add("Thread", typeof(string));
dtNew.Columns.Add("UserName", typeof(string));
MenuAdmin.btnProcessStatus NewPanel = new MenuAdmin.btnProcessStatus();
NewPanel.SetProcess(oLogObject.Process);
NewPanel.SetThread(oLogObject.Thread);
NewPanel.Name = szTableName;
NewPanel.SetName(szTableName);
NewPanel.Click += NewPanel_Click;
dsLogs.Tables.Add(dtNew);
}
DataRow drRow = dsLogs.Tables[szTableName].NewRow();
AddRow(oLogObject, szTableName); // adds the current log object to the table
所以我和队列的问题是,我不能使用它们与数据集,所以我不能说出/按名称引用它们像这样:
DataRow drRow = dsLogs.Tables[szTableName].NewRow();
这是可能的,这是什么叫做这将在队列中完成这个术语?