Skip to content

Commit 83079f6

Browse files
authored
Reformat StringUtil (#13509)
1 parent 3b83a68 commit 83079f6

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

src/System.Management.Automation/utils/StringUtil.cs

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,29 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4+
using System.Globalization;
45
using System.Management.Automation.Host;
56
using System.Threading;
67

78
using Dbg = System.Management.Automation.Diagnostics;
89

910
namespace System.Management.Automation.Internal
1011
{
11-
internal static
12-
class StringUtil
12+
internal static class StringUtil
1313
{
1414
internal static string Format(string format, object arg0)
15-
=> string.Format(Globalization.CultureInfo.CurrentCulture, format, arg0);
15+
=> string.Format(CultureInfo.CurrentCulture, format, arg0);
1616

1717
internal static string Format(string format, object arg0, object arg1)
18-
=> string.Format(Globalization.CultureInfo.CurrentCulture, format, arg0, arg1);
18+
=> string.Format(CultureInfo.CurrentCulture, format, arg0, arg1);
1919

2020
internal static string Format(string format, object arg0, object arg1, object arg2)
21-
=> string.Format(Globalization.CultureInfo.CurrentCulture, format, arg0, arg1, arg2);
21+
=> string.Format(CultureInfo.CurrentCulture, format, arg0, arg1, arg2);
2222

2323
internal static string Format(string format, params object[] args)
24-
=> string.Format(Globalization.CultureInfo.CurrentCulture, format, args);
24+
=> string.Format(CultureInfo.CurrentCulture, format, args);
2525

26-
internal static
27-
string
28-
TruncateToBufferCellWidth(PSHostRawUserInterface rawUI, string toTruncate, int maxWidthInBufferCells)
26+
internal static string TruncateToBufferCellWidth(PSHostRawUserInterface rawUI, string toTruncate, int maxWidthInBufferCells)
2927
{
3028
Dbg.Assert(rawUI != null, "need a reference");
3129
Dbg.Assert(maxWidthInBufferCells >= 0, "maxWidthInBufferCells must be positive");
@@ -58,43 +56,42 @@ internal static
5856
// Typical padding is at most a screen's width, any more than that and we won't bother caching.
5957
private const int IndentCacheMax = 120;
6058

61-
private static readonly string[] IndentCache = new string[IndentCacheMax];
59+
private static readonly string[] s_indentCache = new string[IndentCacheMax];
6260

6361
internal static string Padding(int countOfSpaces)
6462
{
6563
if (countOfSpaces >= IndentCacheMax)
6664
return new string(' ', countOfSpaces);
6765

68-
var result = IndentCache[countOfSpaces];
66+
var result = s_indentCache[countOfSpaces];
6967

7068
if (result == null)
7169
{
72-
Interlocked.CompareExchange(ref IndentCache[countOfSpaces], new string(' ', countOfSpaces), null);
73-
result = IndentCache[countOfSpaces];
70+
Interlocked.CompareExchange(ref s_indentCache[countOfSpaces], new string(' ', countOfSpaces), null);
71+
result = s_indentCache[countOfSpaces];
7472
}
7573

7674
return result;
7775
}
7876

7977
private const int DashCacheMax = 120;
8078

81-
private static readonly string[] DashCache = new string[DashCacheMax];
79+
private static readonly string[] s_dashCache = new string[DashCacheMax];
8280

8381
internal static string DashPadding(int count)
8482
{
8583
if (count >= DashCacheMax)
8684
return new string('-', count);
8785

88-
var result = DashCache[count];
86+
var result = s_dashCache[count];
8987

9088
if (result == null)
9189
{
92-
Interlocked.CompareExchange(ref DashCache[count], new string('-', count), null);
93-
result = DashCache[count];
90+
Interlocked.CompareExchange(ref s_dashCache[count], new string('-', count), null);
91+
result = s_dashCache[count];
9492
}
9593

9694
return result;
9795
}
9896
}
9997
}
100-

0 commit comments

Comments
 (0)