Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
StandardExtensions.cs
2
4{
8 public static class StandardExtensions
9 {
15 public static Iso__639_1.Record ToIso639_1(this string LanguageCode)
16 {
17 if (Iso__639_1.CodeToLanguage(LanguageCode, out string Language))
18 return new Iso__639_1.Record(Language, LanguageCode);
19 else
20 return new Iso__639_1.Record(LanguageCode, LanguageCode);
21 }
22
28 public static Iso__639_1.Record[] ToIso639_1(this string[] LanguageCodes)
29 {
30 int i, c = LanguageCodes.Length;
31 Iso__639_1.Record[] Result = new Iso__639_1.Record[c];
32
33 for (i = 0; i < c; i++)
34 Result[i] = LanguageCodes[i].ToIso639_1();
35
36 return Result;
37 }
38
44 public static string[] ToCodes(this Iso__639_1.Record[] Languages)
45 {
46 int i, c = Languages.Length;
47 string[] Result = new string[c];
48
49 for (i = 0; i < c; i++)
50 Result[i] = Languages[i].Code;
51
52 return Result;
53 }
54 }
55}