在我们写代码的时候,使用this表示当前类的实例。无意中发现项目中的一个基础类的方法中这样的签名:public static void AddParameter<T>(this IDbCommand cm, string paraName, object paraValue, DbType t)请问,此时此刻的this表示什么意思呢?要是让我写代码的话,我会这样写的:
public static void AddParameter<T>(this IDbCommand cm, string paraName, object paraValue, DbType t)从网上搜索了一下,也没有找到相关说法。请高人指点一下。

解决方案 »

  1.   

    public static void AddParameter<T>(this IDbCommand cm, string paraName, object paraValue, DbType t)
    ----------------------------------------------------------------------------------------------------
    这个this拓展了IDbCommand 的方法,相当于在你的代码中可以使用:IDbCommand ddd=....;
    ddd.AddParameter<T>(string paraName, object paraValue, DbType t);
      

  2.   

    to mngzilin
    谢谢,马上结贴。