Skip to content

Commit 7852ebf

Browse files
Use params and char overload (#4231)
1 parent 0468187 commit 7852ebf

File tree

12 files changed

+21
-22
lines changed

12 files changed

+21
-22
lines changed

src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/MarkupCompiler/MarkupCompiler.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,7 +1477,7 @@ internal string GetGenericTypeName(string typeName, string typeArgs)
14771477
StringBuilder sb = new StringBuilder(typeName, 20);
14781478
sb.Append(GENERIC_DELIMITER);
14791479

1480-
_typeArgsList = typeArgs.Split(new Char[] { COMMA });
1480+
_typeArgsList = typeArgs.Split(COMMA);
14811481

14821482
sb.Append(_typeArgsList.Length);
14831483

@@ -1537,7 +1537,7 @@ private bool IsValidCLRNamespace(string ns, bool shouldThrow)
15371537
{
15381538
if (ns.Length > 0)
15391539
{
1540-
string[] nsParts = ns.Split(new char[] { DOTCHAR });
1540+
string[] nsParts = ns.Split(DOTCHAR);
15411541

15421542
foreach (string nsPart in nsParts)
15431543
{
@@ -1629,7 +1629,7 @@ private string ParentFolderPrefix
16291629
{
16301630
string relPath = TargetPath.Substring(SourceFileInfo.SourcePath.Length);
16311631
relPath += SourceFileInfo.RelativeSourceFilePath;
1632-
string[] dirs = relPath.Split(new Char[] { Path.DirectorySeparatorChar });
1632+
string[] dirs = relPath.Split(Path.DirectorySeparatorChar);
16331633
for (int i = 1; i < dirs.Length; i++)
16341634
{
16351635
parentFolderPrefix += PARENTFOLDER;

src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Animation/RepeatBehaviorConverter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public sealed class RepeatBehaviorConverter : TypeConverter
2121
{
2222
#region Data
2323

24-
private static char[] _iterationCharacter = new char[] { 'x' };
24+
private const char _iterationCharacter = 'x';
2525

2626
#endregion
2727

@@ -81,7 +81,7 @@ public override object ConvertFrom(
8181
return RepeatBehavior.Forever;
8282
}
8383
else if ( stringValue.Length > 0
84-
&& stringValue[stringValue.Length - 1] == _iterationCharacter[0])
84+
&& stringValue[stringValue.Length - 1] == _iterationCharacter)
8585
{
8686
string stringDoubleValue = stringValue.TrimEnd(_iterationCharacter);
8787

src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Parsers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ static private Color ParseContextColor(string trimmedColor, IFormatProvider form
105105

106106
string tokens = trimmedColor.Substring(s_ContextColor.Length);
107107
tokens = tokens.Trim();
108-
string[] preSplit = tokens.Split(new Char[] { ' ' });
108+
string[] preSplit = tokens.Split(' ');
109109
if (preSplit.GetLength(0)< 2)
110110
{
111111
throw new FormatException(SR.Get(SRID.Parsers_IllegalToken));

src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Navigation/BaseUriHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ internal static void GetAssemblyNameAndPart(Uri uri, out string partName, out st
285285

286286
if (fHasComponent)
287287
{
288-
string[] assemblyInfo = firstSegment.Split(new char[] { COMPONENT_DELIMITER });
288+
string[] assemblyInfo = firstSegment.Split(COMPONENT_DELIMITER);
289289

290290
int count = assemblyInfo.Length;
291291

@@ -336,7 +336,7 @@ static internal bool IsComponentEntryAssembly(string component)
336336
{
337337
if (component.EndsWith(COMPONENT, StringComparison.OrdinalIgnoreCase))
338338
{
339-
string[] assemblyInfo = component.Split(new Char[] { COMPONENT_DELIMITER });
339+
string[] assemblyInfo = component.Split(COMPONENT_DELIMITER);
340340
// Check whether the assembly name is the same as the EntryAssembly.
341341
int count = assemblyInfo.Length;
342342
if ((count >= 2) && (count <= 4))

src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/Annotations/Anchoring/FixedTextSelectionProcessor.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,20 +222,20 @@ public override IList<ContentLocatorPart>
222222
string value = "";
223223
if (!double.IsNaN(fp.Segments[i].Start.X))
224224
{
225-
value += fp.Segments[i].Start.X.ToString(NumberFormatInfo.InvariantInfo) + TextSelectionProcessor.Separator[0] + fp.Segments[i].Start.Y.ToString(NumberFormatInfo.InvariantInfo);
225+
value += fp.Segments[i].Start.X.ToString(NumberFormatInfo.InvariantInfo) + TextSelectionProcessor.Separator + fp.Segments[i].Start.Y.ToString(NumberFormatInfo.InvariantInfo);
226226
}
227227
else
228228
{
229-
value += TextSelectionProcessor.Separator[0];
229+
value += TextSelectionProcessor.Separator;
230230
}
231-
value += TextSelectionProcessor.Separator[0];
231+
value += TextSelectionProcessor.Separator;
232232
if (!double.IsNaN(fp.Segments[i].End.X))
233233
{
234-
value += fp.Segments[i].End.X.ToString(NumberFormatInfo.InvariantInfo) + TextSelectionProcessor.Separator[0] + fp.Segments[i].End.Y.ToString(NumberFormatInfo.InvariantInfo);
234+
value += fp.Segments[i].End.X.ToString(NumberFormatInfo.InvariantInfo) + TextSelectionProcessor.Separator + fp.Segments[i].End.Y.ToString(NumberFormatInfo.InvariantInfo);
235235
}
236236
else
237237
{
238-
value += TextSelectionProcessor.Separator[0];
238+
value += TextSelectionProcessor.Separator;
239239
}
240240

241241
part.NameValuePairs.Add(TextSelectionProcessor.SegmentAttribute + i.ToString(NumberFormatInfo.InvariantInfo), value);

src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/Annotations/Anchoring/TextSelectionProcessor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public override IList<ContentLocatorPart>
169169
{
170170
GetTextSegmentValues(textSegments[i], elementStart, elementEnd, out startOffset, out endOffset);
171171

172-
part.NameValuePairs.Add(SegmentAttribute + i.ToString(NumberFormatInfo.InvariantInfo), startOffset.ToString(NumberFormatInfo.InvariantInfo) + TextSelectionProcessor.Separator[0] + endOffset.ToString(NumberFormatInfo.InvariantInfo));
172+
part.NameValuePairs.Add(SegmentAttribute + i.ToString(NumberFormatInfo.InvariantInfo), startOffset.ToString(NumberFormatInfo.InvariantInfo) + TextSelectionProcessor.Separator + endOffset.ToString(NumberFormatInfo.InvariantInfo));
173173
}
174174

175175
part.NameValuePairs.Add(CountAttribute, textSegments.Count.ToString(NumberFormatInfo.InvariantInfo));
@@ -424,7 +424,7 @@ internal void SetTargetDocumentPageView(DocumentPageView target)
424424
internal const String IncludeOverlaps = "IncludeOverlaps";
425425

426426
// Potential separators for values in segment name/value pairs
427-
internal static readonly Char[] Separator = new Char[] { ',' };
427+
internal const Char Separator = ',';
428428

429429
// Name of locator part element
430430
internal static readonly XmlQualifiedName CharacterRangeElementName = new XmlQualifiedName("CharacterRange", AnnotationXmlConstants.Namespaces.BaseSchemaNamespace);

src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/Annotations/Anchoring/TextViewSelectionProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public override IList<ContentLocatorPart>
158158

159159
ContentLocatorPart part = new ContentLocatorPart(TextSelectionProcessor.CharacterRangeElementName);// DocumentPageViewLocatorPart();
160160
part.NameValuePairs.Add(TextSelectionProcessor.CountAttribute, 1.ToString(NumberFormatInfo.InvariantInfo));
161-
part.NameValuePairs.Add(TextSelectionProcessor.SegmentAttribute + 0.ToString(NumberFormatInfo.InvariantInfo), startOffset.ToString(NumberFormatInfo.InvariantInfo) + TextSelectionProcessor.Separator[0] + endOffset.ToString(NumberFormatInfo.InvariantInfo));
161+
part.NameValuePairs.Add(TextSelectionProcessor.SegmentAttribute + 0.ToString(NumberFormatInfo.InvariantInfo), startOffset.ToString(NumberFormatInfo.InvariantInfo) + TextSelectionProcessor.Separator + endOffset.ToString(NumberFormatInfo.InvariantInfo));
162162
part.NameValuePairs.Add(TextSelectionProcessor.IncludeOverlaps, Boolean.TrueString);
163163

164164
res.Add(part);

src/Microsoft.DotNet.Wpf/src/PresentationFramework/Microsoft/Win32/FileDialog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1611,7 +1611,7 @@ private string[] GetFilterExtensions()
16111611
if (filter != null)
16121612
{
16131613
// Filter strings are '|' delimited, so we split on them
1614-
string[] tokens = filter.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
1614+
string[] tokens = filter.Split('|', StringSplitOptions.RemoveEmptyEntries);
16151615

16161616
// Calculate the index of the token containing extension(s) selected
16171617
// by the FilterIndex property. Remember FilterIndex is one based.

src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Annotations/Annotation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@ private void Init()
966966
/// <summary>
967967
/// Colon used to split the parts of a qualified name attribute value
968968
/// </summary>
969-
private static readonly char[] _Colon = new char[] { ':' };
969+
private const char _Colon = ':';
970970

971971
#endregion Private Fields
972972
}

src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/ColorConvertedBitmapExtension.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public ColorConvertedBitmapExtension(
4747
throw new ArgumentNullException("image");
4848
}
4949

50-
string[] tokens = ((string)image).Split(new char[] { ' ' });
50+
string[] tokens = ((string)image).Split(' ');
5151

5252
foreach (string str in tokens)
5353
{

0 commit comments

Comments
 (0)