下面是我正在使用的整个课程,我有两个问题,1 这是 Dispose() 的正确使用,还有,为什么我收到错误 No Overload for method 'dispose' 需要 1 个参数。
使用系统;
使用 System.Collections.Generic;
使用 System.Linq;
使用 System.Text;
命名空间爬虫
{
类 LoggingClass : IDisposable
{
public void GenericLogging(string systemMsg, string SystemClass, string SystemSection, string ID, string FixID, string baseURL, string mysqlQueryName, string mysqlQuery)
{
字符串 Loggingall = " 插入 tblLogs " +
"set SystemMsg='" + systemMsg.Replace("'","''") + "'" +
",SystemClass = '" + SystemClass.Replace("'", "''") + "'" +
",SystemSection = '" + SystemSection.Replace("'", "''") + "'" +
",ID = '" + CarID.Replace("'", "''") + "'" +
",FixID = '" + FixID.Replace("'", "''") + "'" +
",baseurl = '" + baseURL.Replace("'", "''") + "'" +
",mysqlqueryName = '" + mysqlQuery.Replace("'", "''") + "'" +
",mysqlquery = '" + mysqlQuery.Replace("'", "''") + "'" +
",TimeStamp = Now()";
MySQLProcessing.MySQLProcessor MYSQLP = new MySQLProcessing.MySQLProcessor();
MYSQLP.MySQLInsertUpdate(Loggingall, "Loggingall");
}
公共无效处置()
{
处置(真);
// 将自己从终结队列中移除
// 防止该对象的终结代码
// 从第二次执行。
GC.SuppressFinalize(this);
}
}
}
这是我更新的代码:}
这是正确的称呼方式吗?我也必须调用处置吗?