1
.Net Core 3 IStringLocalizer.WithCulture(CultureInfo)已过时
我已经将项目从.Net Core 2.2升级到.Net Core 3.0。 在尝试解决所有警告和错误之后,我现在尝试为该警告的解决方案提供资金: 'IStringLocalizer.WithCulture(CultureInfo)' is obsolete: 'This method is obsolete. Use `CurrentCulture` and `CurrentUICulture` instead.' 我正在使用它来更改每个登录用户的网站语言。我有此实现可更改每个用户的网站文化: public class CultureLocalizer : ICultureLocalizer { private readonly IStringLocalizer localizer; public CultureLocalizer(IStringLocalizerFactory factory) { var type = typeof(Resources.PageResources); var assemblyName = new AssemblyName(type.GetTypeInfo().Assembly.FullName); localizer = factory.Create("PageResources", assemblyName.Name); } // if we …