help to convert from VB to C#

  • Thread starter Thread starter zleug
  • Start date Start date
Z

zleug

Guest
Hi All.

How to convert from VB to C#

Public Overrides Function Validate(ByVal value As Object, ByVal cultureInfo As System.Globalization.CultureInfo) As System.Windows.Controls.ValidationResult
If _ObjectType = "Date" Then

If Not IsDate(value) Then
Return New ValidationResult(False, "A value is required")
End If
End If

Return New ValidationResult(True, Nothing)
End Function


I tried like

public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
{
if (_ObjectType == "Date")
{
if (!IsDate(value))
{
return new ValidationResult(false, "A value is required");
}
}
}

But unfortunately it is not correct. Problem in second IF statement condition description.

Thanks.

Continue reading...
 
Back
Top