开发者

Add Extension Method to Service

开发者 https://www.devze.com 2023-02-16 21:05 出处:网络
I am using Tuple class in WCF Service. When i add reference to my web project I get Tuple class. Now i want to add an extension method to Tuple<> class in my service which will be accessible in my

I am using Tuple class in WCF Service. When i add reference to my web project I get Tuple class. Now i want to add an extension method to Tuple<> class in my service which will be accessible in my Web project. Can it be ach开发者_如何学Goieved?


Pointless example that should highlight the point:

namespace Extensions
{
  public static class TupleExtensions
  {
    public static bool IsNull<T1, T2>(this Tuple<T1, T2> t)
      where T1 : class
      where T2 : class
    {
      return t.Item1 == null && t.Item2 == null;
    }
  }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消