1using CommunityToolkit.Mvvm.ComponentModel;
27 if (other ==
null) {
return; }
28 this.MinAge = other.
MinAge;
29 this.MaxAge = other.
MaxAge;
48 set => SetProperty(ref _minAge, value);
59 set => SetProperty(ref _maxAge, value);
69 get => _swimmingStyle;
70 set => SetProperty(ref _swimmingStyle, value);
73 private ushort _distance;
81 set => SetProperty(ref _distance, value);
88 #region SetPropertyFromString helper
100 case nameof(
MinAge): dataObj.MinAge =
byte.Parse(value);
break;
101 case nameof(
MaxAge): dataObj.MaxAge =
byte.Parse(value);
break;
103 if (EnumCoreLocalizedStringHelper.TryParse(value, out
SwimmingStyles parsedStyle))
105 dataObj.SwimmingStyle = parsedStyle;
108 case nameof(
Distance): dataObj.Distance = ushort.Parse(value);
break;
117 #region Equality, HashCode, ToString, Clone
142 => base.GetHashCode();
150 => $
"MinAge: {MinAge}, MaxAge: {MaxAge}, SwimmingStyle: {SwimmingStyle} --> Distance: {Distance}m";
override int GetHashCode()
Serves as the default hash function.
CompetitionDistanceRule(CompetitionDistanceRule other)
Clone constructor for a object.
CompetitionDistanceRule()
Constructor for a new object.
bool Equals(CompetitionDistanceRule other)
Indicates wheather the current object is equal to another object of the same type.
static void SetPropertyFromString(CompetitionDistanceRule dataObj, string propertyName, string value)
Set the requested property in the CompetitionDistanceRule object by parsing the given string value.
SwimmingStyles SwimmingStyle
SwimmingStyles for this rule.
object Clone()
Create a new object that has the same property values than this one.
byte MaxAge
Maximum age for this rule (inclusive)
byte MinAge
Minimum age for this rule (inclusive)
override string ToString()
Returns a string that represents the current object.
ushort Distance
Distance in meters for this rule.
override bool Equals(object obj)
Compare if two are equal.
SwimmingStyles
Available swimming styles.