I just need to know how would the lambda expression C # to vb.net.
if ((object)publicProperties != null && publicProperties.Any())
{
return publicProperties.All(p =>
{
var left = p.GetValue(this, null);
var right = p.GetValue(other, null);
if (typeof(TValueObject).IsAssignableFrom(left.GetType()))
{
//check not self-references...
return Object.ReferenceEquals(left, right);
}
else
return left.Equals(right);
});
}
In vb, the expression is as follows me,
Dim left = Nothing
Dim Right = Nothing
If DirectCast(publicProperties, Object) IsNot Nothing AndAlso publicProperties.Any() Then
Return publicProperties.All(Function(p) (left() = p.GetValue(Me, Nothing))(Right() = p.GetValue(other, Nothing)))
If GetType(TValueObject).IsAssignableFrom(left.[GetType]()) Then
'check not self-references...
Return [Object].ReferenceEquals(left, Right)
Else
Return left.Equals(Right)
End If
Else
Return True
End If
I wonder if this expression would be correct, thanks
Your VB version doesn’t look healthy at all.
Try this: