Extension Method in C# 2.0

前端 未结 4 726
小蘑菇
小蘑菇 2020-12-06 17:28

What namespace do I need to get my extension to work

Here is my Extension Method


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


        
4条回答
  •  离开以前
    2020-12-06 18:15

    As JS said, C# 2.0 doesn't have extension methods.

    Also that extension method would be defined as:

    public static DataTable ToDataTable(this IDataReader reader)
    

    Try calling it like:

    DataReaderExtensions.ToDataTable(
       cust.GetCustomerOrderSummary((string)Session["CustomerNumber"])
       )
    

提交回复
热议问题