How to allow a generic type parameter for a C# method to accept a null argument?

后端 未结 5 1512
情歌与酒
情歌与酒 2021-01-02 11:57
private static Matcher EqualTo(T item)
{
    return new IsEqual(item);
}

How do I modify the above method definition suc

5条回答
  •  -上瘾入骨i
    2021-01-02 12:37

    Maybe implementing a non-generic EqualTo, which takes an Object as the argument type, would solve the issue of rewriting those code lines.

提交回复
热议问题