Compares two objects
Syntax
Example
Library/Library.Test/TestEquatable.cs
C# | Copy Code |
---|
Null<int> nil = null;
Null<int> a = 5;
Null<int> b1 = 6;
Null<int> b2 = 6;
Assert.IsTrue(null <= nil);
Assert.IsTrue(nil <= null);
Assert.IsTrue(b1 <= b2);
Assert.IsTrue(a <= b1);
Assert.IsFalse(b1 <= a);
Assert.IsTrue(nil <= a);
Assert.IsFalse(a <= nil);
Assert.IsTrue(null <= a);
Assert.IsFalse(a <= null);
Assert.IsFalse(null < nil);
Assert.IsFalse(nil < null);
Assert.IsFalse(b1 < b2);
Assert.IsTrue(a < b1);
Assert.IsFalse(b1 < a);
Assert.IsTrue(nil < a);
Assert.IsFalse(a < nil);
Assert.IsTrue(null < a);
Assert.IsFalse(a < null); |
VB.NET | Copy Code |
---|
Dim nil As Null(Of Integer) = Nothing
Dim a As Null(Of Integer) = 5
Dim b1 As Null(Of Integer) = 6
Dim b2 As Null(Of Integer) = 6
Assert.IsTrue(Nothing <= nil)
Assert.IsTrue(nil <= Nothing)
Assert.IsTrue(b1 <= b2)
Assert.IsTrue(a <= b1)
Assert.IsFalse(b1 <= a)
Assert.IsTrue(nil <= a)
Assert.IsFalse(a <= nil)
Assert.IsTrue(Nothing <= a)
Assert.IsFalse(a <= Nothing)
Assert.IsFalse(Nothing < nil)
Assert.IsFalse(nil < Nothing)
Assert.IsFalse(b1 < b2)
Assert.IsTrue(a < b1)
Assert.IsFalse(b1 < a)
Assert.IsTrue(nil < a)
Assert.IsFalse(a < nil)
Assert.IsTrue(Nothing < a)
Assert.IsFalse(a < Nothing) |
Requirements
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
See Also