Skip to content

Logical error in code? #506

Description

@torkuen

Type of issue

Other (describe below)

Description

[Enter feedback here]
Logical error:

if CompareTo result is not >0 it may be Zero as well, which is not reflected in the result message (should be "equal or smaller").

if (((IComparable)value).CompareTo(otherValue) > 0)
{
return ValidationResult.Success;
}

    return new("The current value is smaller than the other one");

Page URL

https://learn.microsoft.com/en-us/dotnet/communitytoolkit/mvvm/observablevalidator

Content source URL

https://github.com/MicrosoftDocs/CommunityToolkit/blob/main/docs/mvvm/ObservableValidator.md

Document Version Independent Id

0b0d4bb1-f1a9-4fa9-af90-e5d30b436701

Article author

Sergio Pedri (@Sergio0694)

Metadata

  • ID: 0b0d4bb1-f1a9-4fa9-af90-e5d30b436701
  • Service: dotnet-communitytoolkit
  • Sub-service: mvvm-toolkit

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions