Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
Previous Versions
.NET Framework 3.0
Class Library
System
Nullable Class
Nullable Methods
 Compare Generic Method

  Switch on low bandwidth view
Nullable.Compare Generic Method
Compares the relative values of two Nullable objects.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

Visual Basic (Declaration)
<ComVisibleAttribute(True)> _
Public Shared Function Compare(Of T As Structure) ( _
    n1 As Nullable(Of T), _
    n2 As Nullable(Of T) _
) As Integer
Visual Basic (Usage)
Dim n1 As Nullable(Of T)
Dim n2 As Nullable(Of T)
Dim returnValue As Integer

returnValue = Nullable.Compare(n1, n2)
C#
[ComVisibleAttribute(true)] 
public static int Compare<T> (
    Nullable<T> n1,
    Nullable<T> n2
) where T : struct
C++
[ComVisibleAttribute(true)] 
public:
generic<typename T> where T : ValueType
static int Compare (
    Nullable<T> n1, 
    Nullable<T> n2
)
J#
J# supports the use of generic types and methods, but not the declaration of new ones.
JScript
JScript does not support generic types and methods.
XAML
Not applicable.

Type Parameters

T

The underlying value type of the n1 and n2 parameters.

Parameters

n1

A Nullable object.

n2

A Nullable object.

Return Value

An integer that indicates the relative values of the n1 and n2 parameters.

Return Value

Description

Less than zero

The HasValue property for n1 is false, and the HasValue property for n2 is true.

-or-

The HasValue properties for n1 and n2 are true, and the value of the Value property for n1 is less than the value of the Value property for n2.

Zero

The HasValue properties for n1 and n2 are false.

-or-

The HasValue properties for n1 and n2 are true, and the value of the Value property for n1 is equal to the value of the Value property for n2.

Greater than zero

The HasValue property for n1 is true, and the HasValue property for n2 is false.

-or-

The HasValue properties for n1 and n2 are true, and the value of the Value property for n1 is greater than the value of the Value property for n2.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

.NET Compact Framework

Supported in: 2.0

XNA Framework

Supported in: 1.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker