相关疑难解决方法(0)

C#2.0中的扩展方法

我需要什么命名空间才能使我的扩展工作

这是我的扩展方法


using System;
using System.Collections.Generic;
using System.Web;
using System.Data;

namespace MyUtilities
{
    public static class DataReaderExtensions
    {
        public static DataTable ToDataTable(IDataReader reader)
        {
            DataTable table = new DataTable();
            table.Load(reader);
            return table;
        }
    }
}

当我尝试像这样使用它

Session["Master"] = cust.GetCustomerOrderSummary((string)Session["CustomerNumber"]).ToDataTable();

它不起作用.这是.net 2.0

c# extension-methods .net-2.0

11
推荐指数
2
解决办法
9096
查看次数

标签 统计

.net-2.0 ×1

c# ×1

extension-methods ×1