Units of distance for the current CultureInfo in .Net
Asked Answered
P

1

15

Is it possible to get the unit of distance from a CultureInfo class or any other class in the System.Globalization namespace.

e.g. "en-GB" would be "mile", "en-FR" would be "km"

Philina answered 16/5, 2011 at 16:26 Comment(1)
AFAIK, there's nothing in the .NET runtime that will do this, but I would love to be proved wrong.Koenraad
S
20

RegionInfo.CurrentRegion.IsMetric

Sandysandye answered 16/5, 2011 at 16:31 Comment(4)
Wow, never knew about this! Of course, it returns true for en-GB, and the asker indicates that "miles" (non-metric) would be preferred for that culture.Respondent
Cody has a point, it returns true for "en-GB" would ahve expected it to return false...Philina
Although some country are using the metric system, many people still use what they learned before and use the imperial system. Here in canada, we are using metric most of the time, except when talking about someone size. e.g.: on the official paper, my size is 180cm, but when I talk about it, I always say that I'm 5.9'. It all come down to suggesting a default for your user, but allow him to change that setting.Unideaed
In the UK, on the motorway (freeway), we use imperial measurements for long distances and metric for short distances! For example, signs will always give long distances in miles (London 56 miles) and short in meters (exit in 300m). Speed is always imperial (Mph) but weight is now metric!Sinistrodextral

© 2022 - 2024 — McMap. All rights reserved.