Skip to content

Comments

Allow to target a collection element in ValidateAttribute #70

Open
thibouf wants to merge 1 commit intov0lt13:mainfrom
thibouf:bug_68
Open

Allow to target a collection element in ValidateAttribute #70
thibouf wants to merge 1 commit intov0lt13:mainfrom
thibouf:bug_68

Conversation

@thibouf
Copy link
Contributor

@thibouf thibouf commented Feb 24, 2026

Here is a sample usage :

  [Validate("List should not be empty", nameof(CheckList), applyToCollection: true)]
  public List<int> intList;

  bool CheckList()
  {
      return intList == null || intList.Count < 3;
  }

  [Validate("List element should not be zero", nameof(CheckList2Index), applyToCollection: false)]
  public List<int> intList2;

  bool CheckList2Index(int index)
  {
      return intList2[index] == 0;
  }

Which would display :
image

Linked to issue #68

…l a method with the collection index if targeting collection element
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant