calling an overloaded method in generic method

后端 未结 5 1655
日久生厌
日久生厌 2021-01-12 23:18
class Test
{
    public BinaryWriter Content { get; private set; }
    public Test Write (T data)
    {
        Content.Write(data);
        return this;
           


        
5条回答
  •  逝去的感伤
    2021-01-13 00:10

    In your write method T is generic, which means that T can be anything, but BinaryWriter.Write doesn't takes a generic overload. So you can't do that.

提交回复
热议问题