Created
May 5, 2018 15:30
-
-
Save christiannagel/84608904a7b6a68658c06e80468b380e to your computer and use it in GitHub Desktop.
CultureData for showing culture information in a tree control
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CultureData | |
{ | |
public CultureInfo CultureInfo { get; set; } | |
public IList<CultureData> SubCultures { get; set; } | |
private double _numberSample = 9876543.21; | |
public string NumberSample => _numberSample.ToString("N", CultureInfo); | |
public string DateSample => DateTime.Today.ToString("D", CultureInfo); | |
public string TimeSample => DateTime.Now.ToString("T", CultureInfo); | |
public RegionInfo RegionInfo | |
{ | |
get | |
{ | |
try | |
{ | |
return new RegionInfo(CultureInfo.Name); | |
} | |
catch (ArgumentException) | |
{ | |
// with some neutral cultures regions are not available | |
return null; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment