A set of languages that can be serialized as a simple space-separated list of ISO language codes.
More...
|
| LanguageSet () |
| Creates a new empty language collection. More...
|
|
| LanguageSet (IEnumerable< CultureInfo > collection) |
| Creates a new language collection pre-filled with a set of languages. More...
|
|
| LanguageSet (string value) |
| Deserializes a space-separated list of languages codes. More...
|
|
bool | Add (string langCode) |
| Adds a language identified by a string to the collection. More...
|
|
bool | ContainsAny (IEnumerable< CultureInfo > targets, bool ignoreCountry=false) |
| Determines whether this language set contains any of a set of target languages. More...
|
|
override string | ToString () |
| Serializes the list as a space-separated list of languages codes. More...
|
|
|
| LanguageSet (SerializationInfo info, StreamingContext context) |
|
A set of languages that can be serialized as a simple space-separated list of ISO language codes.
Uses Unix-style language codes with an underscore (_) separator.
◆ LanguageSet() [1/3]
NanoByte.Common.Collections.LanguageSet.LanguageSet |
( |
| ) |
|
|
inline |
Creates a new empty language collection.
◆ LanguageSet() [2/3]
NanoByte.Common.Collections.LanguageSet.LanguageSet |
( |
IEnumerable< CultureInfo > |
collection | ) |
|
|
inline |
Creates a new language collection pre-filled with a set of languages.
- Parameters
-
◆ LanguageSet() [3/3]
NanoByte.Common.Collections.LanguageSet.LanguageSet |
( |
string |
value | ) |
|
|
inline |
Deserializes a space-separated list of languages codes.
- Parameters
-
value | A space-separated list of languages codes (in the same format as used by the LANG environment variable). |
Unknown language codes in value are replaced with CultureInfo.InvariantCulture rather than raising an ArgumentException.
◆ Add()
bool NanoByte.Common.Collections.LanguageSet.Add |
( |
string |
langCode | ) |
|
Adds a language identified by a string to the collection.
- Parameters
-
langCode | The string identifying the language to add. |
- Returns
true
if the language could be added, false
otherwise.
- Exceptions
-
ArgumentException | langCode is not a valid language code. |
◆ ContainsAny()
bool NanoByte.Common.Collections.LanguageSet.ContainsAny |
( |
IEnumerable< CultureInfo > |
targets, |
|
|
bool |
ignoreCountry = false |
|
) |
| |
|
inline |
Determines whether this language set contains any of a set of target languages.
- Parameters
-
targets | The language set to match against. |
ignoreCountry | true to compare only the two-letter language name; false to also compare the country code. |
◆ ToString()
override string NanoByte.Common.Collections.LanguageSet.ToString |
( |
| ) |
|
|
inline |
Serializes the list as a space-separated list of languages codes.
The documentation for this class was generated from the following file:
- Common/Collections/LanguageSet.cs