Skip to content

Use params and char overload #4231

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,7 @@ internal string GetGenericTypeName(string typeName, string typeArgs)
StringBuilder sb = new StringBuilder(typeName, 20);
sb.Append(GENERIC_DELIMITER);

_typeArgsList = typeArgs.Split(new Char[] { COMMA });
_typeArgsList = typeArgs.Split(COMMA);

sb.Append(_typeArgsList.Length);

Expand Down Expand Up @@ -1537,7 +1537,7 @@ private bool IsValidCLRNamespace(string ns, bool shouldThrow)
{
if (ns.Length > 0)
{
string[] nsParts = ns.Split(new char[] { DOTCHAR });
string[] nsParts = ns.Split(DOTCHAR);

foreach (string nsPart in nsParts)
{
Expand Down Expand Up @@ -1629,7 +1629,7 @@ private string ParentFolderPrefix
{
string relPath = TargetPath.Substring(SourceFileInfo.SourcePath.Length);
relPath += SourceFileInfo.RelativeSourceFilePath;
string[] dirs = relPath.Split(new Char[] { Path.DirectorySeparatorChar });
string[] dirs = relPath.Split(Path.DirectorySeparatorChar);
for (int i = 1; i < dirs.Length; i++)
{
parentFolderPrefix += PARENTFOLDER;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public sealed class RepeatBehaviorConverter : TypeConverter
{
#region Data

private static char[] _iterationCharacter = new char[] { 'x' };
private const char _iterationCharacter = 'x';

#endregion

Expand Down Expand Up @@ -81,7 +81,7 @@ public override object ConvertFrom(
return RepeatBehavior.Forever;
}
else if ( stringValue.Length > 0
&& stringValue[stringValue.Length - 1] == _iterationCharacter[0])
&& stringValue[stringValue.Length - 1] == _iterationCharacter)
{
string stringDoubleValue = stringValue.TrimEnd(_iterationCharacter);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ static private Color ParseContextColor(string trimmedColor, IFormatProvider form

string tokens = trimmedColor.Substring(s_ContextColor.Length);
tokens = tokens.Trim();
string[] preSplit = tokens.Split(new Char[] { ' ' });
string[] preSplit = tokens.Split(' ');
if (preSplit.GetLength(0)< 2)
{
throw new FormatException(SR.Get(SRID.Parsers_IllegalToken));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ internal static void GetAssemblyNameAndPart(Uri uri, out string partName, out st

if (fHasComponent)
{
string[] assemblyInfo = firstSegment.Split(new char[] { COMPONENT_DELIMITER });
string[] assemblyInfo = firstSegment.Split(COMPONENT_DELIMITER);

int count = assemblyInfo.Length;

Expand Down Expand Up @@ -336,7 +336,7 @@ static internal bool IsComponentEntryAssembly(string component)
{
if (component.EndsWith(COMPONENT, StringComparison.OrdinalIgnoreCase))
{
string[] assemblyInfo = component.Split(new Char[] { COMPONENT_DELIMITER });
string[] assemblyInfo = component.Split(COMPONENT_DELIMITER);
// Check whether the assembly name is the same as the EntryAssembly.
int count = assemblyInfo.Length;
if ((count >= 2) && (count <= 4))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,20 +222,20 @@ public override IList<ContentLocatorPart>
string value = "";
if (!double.IsNaN(fp.Segments[i].Start.X))
{
value += fp.Segments[i].Start.X.ToString(NumberFormatInfo.InvariantInfo) + TextSelectionProcessor.Separator[0] + fp.Segments[i].Start.Y.ToString(NumberFormatInfo.InvariantInfo);
value += fp.Segments[i].Start.X.ToString(NumberFormatInfo.InvariantInfo) + TextSelectionProcessor.Separator + fp.Segments[i].Start.Y.ToString(NumberFormatInfo.InvariantInfo);
}
else
{
value += TextSelectionProcessor.Separator[0];
value += TextSelectionProcessor.Separator;
}
value += TextSelectionProcessor.Separator[0];
value += TextSelectionProcessor.Separator;
if (!double.IsNaN(fp.Segments[i].End.X))
{
value += fp.Segments[i].End.X.ToString(NumberFormatInfo.InvariantInfo) + TextSelectionProcessor.Separator[0] + fp.Segments[i].End.Y.ToString(NumberFormatInfo.InvariantInfo);
value += fp.Segments[i].End.X.ToString(NumberFormatInfo.InvariantInfo) + TextSelectionProcessor.Separator + fp.Segments[i].End.Y.ToString(NumberFormatInfo.InvariantInfo);
}
else
{
value += TextSelectionProcessor.Separator[0];
value += TextSelectionProcessor.Separator;
}

part.NameValuePairs.Add(TextSelectionProcessor.SegmentAttribute + i.ToString(NumberFormatInfo.InvariantInfo), value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public override IList<ContentLocatorPart>
{
GetTextSegmentValues(textSegments[i], elementStart, elementEnd, out startOffset, out endOffset);

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

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

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

// Name of locator part element
internal static readonly XmlQualifiedName CharacterRangeElementName = new XmlQualifiedName("CharacterRange", AnnotationXmlConstants.Namespaces.BaseSchemaNamespace);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public override IList<ContentLocatorPart>

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

res.Add(part);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1612,7 +1612,7 @@ private string[] GetFilterExtensions()
if (filter != null)
{
// Filter strings are '|' delimited, so we split on them
string[] tokens = filter.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
string[] tokens = filter.Split('|', StringSplitOptions.RemoveEmptyEntries);

// Calculate the index of the token containing extension(s) selected
// by the FilterIndex property. Remember FilterIndex is one based.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ private void Init()
/// <summary>
/// Colon used to split the parts of a qualified name attribute value
/// </summary>
private static readonly char[] _Colon = new char[] { ':' };
private const char _Colon = ':';

#endregion Private Fields
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public ColorConvertedBitmapExtension(
throw new ArgumentNullException("image");
}

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

foreach (string str in tokens)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2528,7 +2528,7 @@ internal override void WriteRecordData(BinaryWriter bamlBinaryWriter)
if (ValueType != null && ValueType.IsEnum)
{
uint uintValue = 0;
string [] enumValues = Value.Split(new Char[] { ',' });
string [] enumValues = Value.Split(',');

// if the Enum is a flag, then resolve each flag value in the enum value string.
foreach (string enumValue in enumValues)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ static internal class ContainerUtilities
/// Used by ConvertBackSlashPathToStringArrayPath and
/// ConvertStringArrayPathToBackSlashPath to separate path elements.
static readonly internal char PathSeparator = Path.DirectorySeparatorChar;
static private readonly char[] _PathSeparatorArray = new char[] { PathSeparator };
static readonly internal string PathSeparatorAsString = new string(ContainerUtilities.PathSeparator, 1);

static private readonly CaseInsensitiveOrdinalStringComparer _stringCaseInsensitiveComparer = new CaseInsensitiveOrdinalStringComparer();
Expand Down Expand Up @@ -347,7 +346,7 @@ static internal string[] ConvertBackSlashPathToStringArrayPath(string backSlashP

// Build the array
string[] splitArray =
backSlashPath.Split(_PathSeparatorArray);
backSlashPath.Split(PathSeparator);

// Look for empty strings in the array
foreach (string arrayElement in splitArray)
Expand Down