using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace System
{
/// Supports a value type that can be assigned null like a reference type. This class cannot be inherited.
/// 1
// Token: 0x02000697 RID: 1687
[ComVisible(true)]
public static class Nullable
{
/// Compares the relative values of two objects.
/// An integer that indicates the relative values of the and parameters.Return ValueDescriptionLess than zeroThe property for is false, and the property for is true.-or-The properties for and are true, and the value of the property for is less than the value of the property for .ZeroThe properties for and are false.-or-The properties for and are true, and the value of the property for is equal to the value of the property for .Greater than zeroThe property for is true, and the property for is false.-or-The properties for and are true, and the value of the property for is greater than the value of the property for .
/// A object.
/// A object.
/// The underlying value type of the and parameters.
// Token: 0x06003FE8 RID: 16360 RVA: 0x000D7A78 File Offset: 0x000D5C78
[ComVisible(false)]
public static int Compare(T? value1, T? value2) where T : struct
{
if (!value1.has_value)
{
return (!value2.has_value) ? 0 : (-1);
}
if (!value2.has_value)
{
return 1;
}
return Comparer.Default.Compare(value1.value, value2.value);
}
/// Indicates whether two specified objects are equal.
/// true if the parameter is equal to the parameter; otherwise, false. The return value depends on the and properties of the two parameters that are compared.Return ValueDescriptiontrueThe properties for and are false. -or-The properties for and are true, and the properties of the parameters are equal.falseThe property is true for one parameter and false for the other parameter.-or-The properties for and are true, and the properties of the parameters are unequal.
/// A object.
/// A object.
/// The underlying value type of the and parameters.
// Token: 0x06003FE9 RID: 16361 RVA: 0x000D7ACC File Offset: 0x000D5CCC
[ComVisible(false)]
public static bool Equals(T? value1, T? value2) where T : struct
{
return value1.has_value == value2.has_value && (!value1.has_value || EqualityComparer.Default.Equals(value1.value, value2.value));
}
/// Returns the underlying type argument of the specified nullable type.
/// The type argument of the parameter, if the parameter is a closed generic nullable type; otherwise, null.
/// A object that describes a closed generic nullable type.
///
/// is null.
// Token: 0x06003FEA RID: 16362 RVA: 0x000D7B0C File Offset: 0x000D5D0C
public static Type GetUnderlyingType(Type nullableType)
{
if (nullableType == null)
{
throw new ArgumentNullException("nullableType");
}
if (nullableType.IsGenericType && nullableType.GetGenericTypeDefinition() == typeof(Nullable<>))
{
return nullableType.GetGenericArguments()[0];
}
return null;
}
}
}