UnknownDextr
UnknownDextr

Reputation: 51

No suitable method found to override?

I keep getting this error

 Dev_xsc_Build.BigEndianBinaryReader.ReadInt16()': no suitable method found to override

But I'm not sure where I am going wrong with

public override short ReadInt16()
    {
        byte[] byteBuffer = base.ReadBytes(2);
        return (short)((byteBuffer[0] << 8) | byteBuffer[1]);
    }

Any help please?

Upvotes: 3

Views: 12371

Answers (1)

Reed Copsey
Reed Copsey

Reputation: 564851

You're saying to override a virtual method: public **override** short ReadInt16(). This requires you to be inheriting from a class that contains a virtual method that matches that declaration.

In your case, the base class does not provide a virtual method that matches. You should be able to just remove the override keyword:

public short ReadInt16()
{
    byte[] byteBuffer = base.ReadBytes(2);
    return (short)((byteBuffer[0] << 8) | byteBuffer[1]);
}

Upvotes: 2

Related Questions