Beispiel #1
0
 /// <summary>
 /// Converts a Windows time zone ID to an equivalent system time zone ID for a region.
 ///
 /// For example, system time zone ID "America/Los_Angeles" is returned for input Windows ID "Pacific Standard Time" and region "US" (or null), "America/Vancouver" is returned for the same Windows ID "Pacific Standard Time" and region "CA".
 /// </summary>
 /// <param name="winId">A Windows time zone ID.</param>
 /// <param name="region">region code, or NULL if no regional preference.</param>
 /// <returns>A system time zone ID</returns>
 public static string GetIdForWindowsId(string winId, string region)
 {
     return(NativeMethods.GetUnicodeString((ptr, length) =>
     {
         length = NativeMethods.ucal_getTimeZoneIDForWindowsId(winId, region, ptr, length, out ErrorCode errorCode);
         return new Tuple <ErrorCode, int>(errorCode, length);
     }));
 }