2011-12-05 2 views

答えて

0

あなたが本当に読みやすくするために括弧を使用する必要があります。それでも比較は醜いです。

Private Function NullableIntsEqual(ByVal a As Integer?, ByVal b As Integer?) As Boolean 
    If ((a IsNot Nothing And b IsNot Nothing) AndAlso (a = b)) Or (a Is Nothing And b Is Nothing) Then 
     Return True 
    Else 
     Return False 
    End If 
End Function 

がevalcheckラインが

evalcheck = NullableIntsEqual(aEntityId, bEntityId) And NullableIntsEqual(aCheckNumber, bCheckNumber) 
になりますけれども

If ((aEntityId IsNot Nothing And bEntityId IsNot Nothing) AndAlso (aEntityId = bEntityId)) Or (aEntityId Is Nothing And bEntityId Is Nothing) Then 
    If ((aCheckNumber IsNot Nothing And bCheckNumber IsNot Nothing) AndAlso (aEntityId = bEntityId)) Or (aCheckNumber Is Nothing And bCheckNumber Is Nothing) Then 
     evalcheck = True 
    Else 
     evalcheck = False 
    End If 
Else 
    evalcheck = False 
End If 

私はこの方法でよりよい好みます

関連する問題