79650634

Date: 2025-06-03 04:50:28
Score: 2.5
Natty:
Report link
public class YourIntDecl : IMinMaxDecl<Int16>
{
    public Int16? MinValue { get; set; }
    public Int16? MaxValue { get; set; }
}

YourIntDecl : IMinMaxDecl<Int16?> Should fix it no? You are telling the generic type it Must be of type Int16 that doesn't allow null. But the type expected is a nullable type.

The reason the abstract class works, I think, is because the abstract comes with a base implementation of Int16? While the interface has no inherent properties. It can only force your Implemention to have a property of type T. Which you provide as Int16 non nullable.

In the non compiling example, you are in fact NOT, abiding by the interface contract.

Reasons:
  • RegEx Blacklisted phrase (1.5): fix it no?
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: user30704159