【求教】封装一个类,方法为参数
int allcounts = 0;string ip = CommonMethod.GetUserIP();
string id = System.Guid.NewGuid().ToString("N");
DataSet dataSet = new DataSet();
DateTime startTime = DateTime.Now;
bool insertStage;
try
{
insertStage = CommonMethod.WriteInterfaceRequestLog(id, 1, url, ip, "IADPPrice", 0, ref allcounts);
dataSet = select(cityName, curPage, pageSize, ref allcounts);
insertStage = CommonMethod.WriteInterfaceRequestLog(id, 2, url, ip, "IADPPrice", Convert.ToDecimal((DateTime.Now - startTime).TotalSeconds), ref allcounts);
}
catch
{
insertStage = CommonMethod.WriteInterfaceRequestLog(id, 3, url, ip, "IADPPrice", Convert.ToDecimal((DateTime.Now - startTime).TotalSeconds), ref allcounts);
}
我是想如果把加粗部分再封装一下应该怎么做呢 封装 --------------------编程问答-------------------- 采用委托,你可以查看一下多播委托。 --------------------编程问答-------------------- 在VS里面选中 直接抽象为方法,然后根据自己的需求再改改就可以了 --------------------编程问答--------------------
补充:.NET技术 , C#