/** * Returns the measurement system used in the locale specified by the locale. * * @param locale The locale for which the measurement system to be retrieved. * @return MeasurementSystem the measurement system used in the locale. * @stable ICU 3.0 */ public static MeasurementSystem GetMeasurementSystem(ULocale locale) { UResourceBundle sysBundle = MeasurementTypeBundleForLocale(locale, MEASUREMENT_SYSTEM); switch (sysBundle.GetInt32()) { case 0: return(MeasurementSystem.SI); case 1: return(MeasurementSystem.US); case 2: return(MeasurementSystem.UK); default: // return null if the object is null or is not an instance // of integer indicating an error return(null); } }
// ICU4N specific - de-nested MeasurementSystem /// <summary> /// Returns the measurement system used in the locale specified by the locale. /// </summary> /// <param name="locale">The locale for which the measurement system to be retrieved.</param> /// <returns>The <see cref="MeasurementSystem"/> used in the locale.</returns> /// <stable>ICU 3.0</stable> public static MeasurementSystem GetMeasurementSystem(ULocale locale) { UResourceBundle sysBundle = MeasurementTypeBundleForLocale(locale, MEASUREMENT_SYSTEM); return((MeasurementSystem)sysBundle.GetInt32()); }