Make Culture lookup case-insensitive; add GetOrDefault()
Changed Culture indexer to use case-insensitive language matching. Added GetOrDefault() to return a Culture or the default if not found.
This commit is contained in:
@@ -7,7 +7,9 @@
|
||||
public IEnumerable<string> FIClasses => this.Select(c => c.FIClass);
|
||||
|
||||
public Culture Default => this.First();
|
||||
|
||||
public Culture? this[string? language] => language is null ? null : this.Where(c => c.Language == language).FirstOrDefault();
|
||||
|
||||
public Culture GetOrDefault(string? language) => this[language] ?? Default;
|
||||
|
||||
public Culture? this[string? language] => language is null ? null : this.FirstOrDefault(c => string.Equals(c.Language, language, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user