Pa1 = 253,
OemClear = 254,
}
- public readonly partial struct ConsoleKeyInfo
+ public readonly partial struct ConsoleKeyInfo : System.IEquatable<System.ConsoleKeyInfo>
{
private readonly int _dummyPrimitive;
public ConsoleKeyInfo(char keyChar, System.ConsoleKey key, bool shift, bool alt, bool control) { throw null; }
namespace System
{
- public readonly struct ConsoleKeyInfo
+ public readonly struct ConsoleKeyInfo : IEquatable<ConsoleKeyInfo>
{
private readonly char _keyChar;
private readonly ConsoleKey _key;
public override bool Equals(object? value)
{
- return value is ConsoleKeyInfo && Equals((ConsoleKeyInfo)value);
+ return value is ConsoleKeyInfo info && Equals(info);
}
public bool Equals(ConsoleKeyInfo obj)
Assert.False(default(ConsoleKeyInfo).Equals(new object()));
}
+ [Fact]
+ public void ImplementsIEquatableInterface() => Assert.True(typeof(IEquatable<ConsoleKeyInfo>).IsAssignableFrom(typeof(ConsoleKeyInfo)));
+
public static readonly object[][] NotEqualConsoleKeyInfos = {
new object[] { new ConsoleKeyInfo('a', ConsoleKey.A, true, true, true), new ConsoleKeyInfo('b', ConsoleKey.A, true, true, true) },
new object[] { new ConsoleKeyInfo('a', ConsoleKey.A, true, true, true), new ConsoleKeyInfo('a', ConsoleKey.B, true, true, true) },