mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Add StringUtil.Format overload to avoid unnecessary allocations (#13408)
* Rename parameters to correspond to string.Format * Add addtional overload to avoid allocations at call sites
This commit is contained in:
@@ -11,26 +11,17 @@ namespace System.Management.Automation.Internal
|
||||
internal static
|
||||
class StringUtil
|
||||
{
|
||||
internal static
|
||||
string
|
||||
Format(string formatSpec, object o)
|
||||
{
|
||||
return string.Format(System.Globalization.CultureInfo.CurrentCulture, formatSpec, o);
|
||||
}
|
||||
internal static string Format(string format, object arg0)
|
||||
=> string.Format(Globalization.CultureInfo.CurrentCulture, format, arg0);
|
||||
|
||||
internal static
|
||||
string
|
||||
Format(string formatSpec, object o1, object o2)
|
||||
{
|
||||
return string.Format(System.Globalization.CultureInfo.CurrentCulture, formatSpec, o1, o2);
|
||||
}
|
||||
internal static string Format(string format, object arg0, object arg1)
|
||||
=> string.Format(Globalization.CultureInfo.CurrentCulture, format, arg0, arg1);
|
||||
|
||||
internal static
|
||||
string
|
||||
Format(string formatSpec, params object[] o)
|
||||
{
|
||||
return string.Format(System.Globalization.CultureInfo.CurrentCulture, formatSpec, o);
|
||||
}
|
||||
internal static string Format(string format, object arg0, object arg1, object arg2)
|
||||
=> string.Format(Globalization.CultureInfo.CurrentCulture, format, arg0, arg1, arg2);
|
||||
|
||||
internal static string Format(string format, params object[] args)
|
||||
=> string.Format(Globalization.CultureInfo.CurrentCulture, format, args);
|
||||
|
||||
internal static
|
||||
string
|
||||
|
||||
Reference in New Issue
Block a user