CultureInfo.ClearCachedData 方法


刷新缓存的区域性相关信息。Refreshes cached culture-related information.

 void ClearCachedData();
public void ClearCachedData ();
member this.ClearCachedData : unit -> unit
Public Sub ClearCachedData ()


默认情况下,会在第一次请求时缓存信息(如默认区域性和格式模式)。Information, such as the default culture and format patterns, is cached the first time it is requested. AppDomain的生命周期(例如,当用户修改 "控制面板" 的 "区域和语言选项" 部分时),该信息可能会更改。That information can change during the life of the AppDomain, for example, when the user modifies the regional and language options portion of Control Panel. CultureInfo 类不会自动检测系统设置中的更改。However, the CultureInfo class does not automatically detect changes in the system settings.

ClearCachedData 方法清除 GetCultureInfo 创建的 CultureInfo 对象的缓存,并基于当前系统设置刷新 CurrentCultureCurrentUICultureCurrentRegion 属性中的信息。The ClearCachedData method clears the cache of CultureInfo objects created by GetCultureInfo and refreshes the information in the CurrentCulture, CurrentUICulture, and CurrentRegion properties, based on the current system settings.

ClearCachedData 方法不刷新现有线程的 Thread.CurrentCulture 属性中的信息。The ClearCachedData method does not refresh the information in the Thread.CurrentCulture property for existing threads. 但是,将来的线程将具有任何新的 CultureInfo 属性值。However, future threads will have any new CultureInfo property values.