Cliargs comes with some native rules for comparing some dotnet types (Integer, Double…). This rules could be used directly or customized.
EqualsRule
This rule checks whether a given value equals to another one.
1
2
3
4
5
// Create a new instance using the constructor
new EqualsRule<string>("Sample String");
// Or use the Value method to get a new instance
EqualsRule<int>.Value(3);
GreaterThanRule
This rule checks if a given value is greater than another value.
1
2
3
4
5
// Use the rule constructor to create a new instance
new GreaterThanRule<string>("C");
// Or Use the static `Value` method to get a new instance
GreaterThanRule<int>.Value(1);
GreaterThanOrEqualsRule
This rule is similar to GreaterThanRule but it checks if a given value is greater than or equals to another value.
1
2
3
4
5
// Create a new instance using the rule constructor
new GreaterThanOrEqualsRule<FakeEnum>(FakeEnum.EnumElement);
// Use the static `Value` method to get a new instance
GreaterThanOrEqualsRule<int>.Value(1);
LessThanRule
This rule checks if a given value is less than another value.
1
2
3
4
5
// Use the rule constructor to create a new instance
new LessThanRule<string>("C");
// Or Use the static `Value` method to get a new instance
LessThanRule<int>.Value(1);
LessThanOrEqualsRule
This rule is similar to LessThanRule but it checks if a given value is less than or equals to another value.
1
2
3
4
5
// Create a new instance using the rule constructor
new LessThanOrEqualsRule<FakeEnum>(FakeEnum.EnumElement);
// Use the static `Value` method to get a new instance
LessThanOrEqualsRule<int>.Value(1);