Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/compound condition #43

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

SirLpc
Copy link

@SirLpc SirLpc commented May 16, 2022

We offen need to show/hide a field depends on other fields conditions more than one, with this commit we can do it like this:
compound-condition

@arimger
Copy link
Owner

arimger commented May 17, 2022

Hello! Thanks for the request. The reason why a similar feature was never implemented is that I recommend using properties instead of defining multiple sources directly in the attribute.

Instead of this:

[HideIf(new string[] { "a", "b" }, new object[] { "value0", "value1" }, logicAnd: true)]
public int var1;

you can do this:

[HideIf(nameof(MyProperty), true)]
public int var1;

public bool MyProperty => a == "value0" && b == "value1";

It's, of course, my opinion, that the 2nd option is better.

@SirLpc
Copy link
Author

SirLpc commented May 18, 2022

Yes I know this. and I had done like this before, but with this implimentation, my config file`s has many redundance code like this:
image

I doubt is there a better way :P

@arimger arimger added the enhancement New feature or request label Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants