Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/System.Private.CoreLib/shared/System/FormattableString.cs')
-rw-r--r--src/System.Private.CoreLib/shared/System/FormattableString.cs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/System.Private.CoreLib/shared/System/FormattableString.cs b/src/System.Private.CoreLib/shared/System/FormattableString.cs
index 6369363b5..51863d6e7 100644
--- a/src/System.Private.CoreLib/shared/System/FormattableString.cs
+++ b/src/System.Private.CoreLib/shared/System/FormattableString.cs
@@ -73,6 +73,29 @@ namespace System
return formattable.ToString(Globalization.CultureInfo.InvariantCulture);
}
+ /// <summary>
+ /// Format the given object in the current culture. This static method may be
+ /// imported in C# by
+ /// <code>
+ /// using static System.FormattableString;
+ /// </code>.
+ /// Within the scope
+ /// of that import directive an interpolated string may be formatted in the
+ /// current culture by writing, for example,
+ /// <code>
+ /// CurrentCulture($"{{ lat = {latitude}; lon = {longitude} }}")
+ /// </code>
+ /// </summary>
+ public static string CurrentCulture(FormattableString formattable)
+ {
+ if (formattable == null)
+ {
+ throw new ArgumentNullException(nameof(formattable));
+ }
+
+ return formattable.ToString(Globalization.CultureInfo.CurrentCulture);
+ }
+
public override string ToString()
{
return ToString(Globalization.CultureInfo.CurrentCulture);