Runtime: SR.Format with format provider

Created on 2 Jan 2019  路  2Comments  路  Source: dotnet/runtime

We use SR.Format to format resource strings. But there are a bunch of places where the formatting is done with a specific format provider, e.g. CultureInfo.InvariantCulture, and such places currently use string.Format because there is no SR.Format overload today that takes a format provider.

I suggest we should either add such overloads and switch all formatting of resource strings over to use SR.Format, or we should drop SR.Format and just use string.Format everywhere.

This applies to both coreclr and corefx.

cc: @tarekgh, @krwq

area-System.Runtime

Most helpful comment

I suggest we should either add such overloads and switch all formatting of resource strings over to use SR.Format, or we should drop SR.Format and just use string.Format everywhere.

I recall we had some logic inside SR.Format for .Net Native when we decide to drop the resources (and use the resource keys only) for the size sake. so we should be careful if we decide to drop SR.Format to ensure we'll not broke anything. I would say adding the overload taking the provider would be better.

All 2 comments

I suggest we should either add such overloads and switch all formatting of resource strings over to use SR.Format, or we should drop SR.Format and just use string.Format everywhere.

I recall we had some logic inside SR.Format for .Net Native when we decide to drop the resources (and use the resource keys only) for the size sake. so we should be careful if we decide to drop SR.Format to ensure we'll not broke anything. I would say adding the overload taking the provider would be better.

This issue was moved to dotnet/corefx#35001

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jzabroski picture jzabroski  路  3Comments

GitAntoinee picture GitAntoinee  路  3Comments

yahorsi picture yahorsi  路  3Comments

matty-hall picture matty-hall  路  3Comments

v0l picture v0l  路  3Comments