-
Notifications
You must be signed in to change notification settings - Fork 3
/
Nothing.cs
49 lines (44 loc) · 1.47 KB
/
Nothing.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System;
namespace Ramda.NET
{
/// <summary>
/// Equivalent to null
/// </summary>
public class Nothing
{
internal Nothing() {
}
/// <summary>
/// Determines whether the specified <see cref="System.Object" />, is equal to this instance.
/// </summary>
/// <param name="obj">The <see cref="System.Object" /> to compare with this instance.</param>
/// <returns>
/// <c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>.
/// </returns>
public override bool Equals(object obj) {
if (obj is Nothing) {
return true;
}
return Equals(obj, null);
}
/// <summary>
/// Returns a hash code for this instance.
/// </summary>
/// <returns>
/// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
/// </returns>
public override int GetHashCode() {
return base.GetHashCode();
}
/// <summary>
/// Performs an explicit conversion from <see cref="Nothing"/> to <see cref="System.Boolean"/>.
/// </summary>
/// <param name="x">The x.</param>
/// <returns>
/// The result of the conversion.
/// </returns>
public static explicit operator bool(Nothing x) {
return false;
}
}
}