Msdn:
public static readonly ValidationResult ValidationResult.Success
Represents the success of the validation (true if validation was
successful; otherwise, false).
The text in above excerpt doesn’t make sense to me, since Success field doesn’t return a value of type bool, and the value it does return ( ie ValidationResult instance ) doesn’t contain any boolean property or field which we could set to a value indicating a success or failure of a validation?!
Any ideas what is the purpose of this field?
ValidationResult.Successis always constantnull. Its purpose is documentation.In order to succeed validation you could either write:
or
In the first case I ask myself “What does this mean? What does null mean? Is this success, or fail, or something else?“. In the latter case the code is inherently documented without the need for informal text docs.