public string this[string columnName] { get { return(columnName switch { "ShortName" when string.IsNullOrEmpty(ShortName.Trim()) => "Short Name can't be empty", "LongName" when string.IsNullOrEmpty(LongName.Trim()) => "Long Name can't be empty", "Age" when Age < 18 || Age > 100 => "Age must be between [18, 100]", "Height" when Height < 100 || Height > 300 => "Height must be between [100, 300]", "Weight" when Weight < 40 || Weight > 200 => "Weight must be between [40, 200]", "Club" when string.IsNullOrEmpty(Club.Trim()) => "Club can't be empty", "Nationality" when string.IsNullOrEmpty(Nationality.Trim()) => "Nationality can't be empty", "Overall" when Overall < 0 || Overall > 100 => "Overall must be between [0, 100]", "Potential" when Potential < 0 || Potential > 100 => "Potential must be between [0, 100]", "SofifaID" when SofifaID < 0 => "SofifaID can't be negative", "PlayerURL" when string.IsNullOrEmpty(PlayerURL.Trim()) => "Player URL can't be empty", _ => null });
/// <summary> /// Prints out the name, long name first, if it is null then it tries short name. /// </summary> /// <returns></returns> public override string ToString() { return(LongName != null ? LongName.Trim(new char[] { '\0' }) : ShortName.Trim(new char[] { '\0' })); }