Ignore:
Timestamp:
Apr 13, 2007, 5:12:31 PM (18 years ago)
Author:
イグトランス (egtra)
Message:

Object.ReferenceEqualsを追加

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Include/Classes/System/Object.ab

    r207 r212  
    1717    End Function
    1818    Static Function Equals( objectA As Object, objectB As Object ) As Boolean
    19         Return objectA.Equals( objectB )
     19        If VarPtr(objectA) = 0 /*objectA = Nothing*/ Then
     20            Return VarPtr(objectB) = 0 'objectB = Nothing
     21        Else
     22            Return objectA.Equals( objectB )
     23        End If
     24    End Function
     25
     26    ' 参照先が等しいか判断する
     27    Static Function ReferenceEquals(objectA As Object, objectB As Object) As Boolean
     28        If VarPtr(objectA) = 0 /*objectA = Nothing*/ Then
     29            Return VarPtr(objectB) = 0 'objectB = Nothing
     30        ElseIf VarPtr(objectB) = 0 /*objectB = Nothing*/ Then
     31            Return False
     32        Else
     33            Return GetPointer(VarPtr(objectA)) = GetPointer(VarPtr(objectA))
     34        End If
    2035    End Function
    2136
Note: See TracChangeset for help on using the changeset viewer.