diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/MarkupCompiler/MarkupCompiler.cs b/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/MarkupCompiler/MarkupCompiler.cs index 8adf6cf0664..9638cd29f66 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/MarkupCompiler/MarkupCompiler.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/MarkupCompiler/MarkupCompiler.cs @@ -487,7 +487,7 @@ private void Initialize(FileUnit sourceFile) } } - int pathEndIndex = SourceFileInfo.RelativeSourceFilePath.LastIndexOf(string.Empty + Path.DirectorySeparatorChar, StringComparison.Ordinal); + int pathEndIndex = SourceFileInfo.RelativeSourceFilePath.LastIndexOf(Path.DirectorySeparatorChar); string targetPath = TargetPath + SourceFileInfo.RelativeSourceFilePath.Substring(0, pathEndIndex + 1); // Create if not already exists @@ -711,7 +711,7 @@ private SourceFileInfo OnSourceFileResolve(FileUnit file) if (sourceFileInfo.IsXamlFile) { - int fileExtIndex = file.Path.LastIndexOf(DOT, StringComparison.Ordinal); + int fileExtIndex = file.Path.LastIndexOf(DOTCHAR); sourceFileInfo.RelativeSourceFilePath = file.Path.Substring(0, fileExtIndex); } @@ -1415,7 +1415,7 @@ private string GetFullClassName(string ns, string className) internal void ValidateFullSubClassName(ref string subClassFullName) { bool isValid = false; - int index = subClassFullName.LastIndexOf(DOT, StringComparison.Ordinal); + int index = subClassFullName.LastIndexOf(DOTCHAR); if (index > 0) { @@ -1444,7 +1444,7 @@ private bool CrackClassName(ref string className, out string ns) if (className.Length > 0) { // Split the Namespace - int index = className.LastIndexOf(DOT, StringComparison.Ordinal); + int index = className.LastIndexOf(DOTCHAR); if (index > 0) { @@ -2273,7 +2273,7 @@ private static CodeTypeReference GenerateConstructedTypeReference(Type t, string // NOTE: Remove when CodeDom is fixed to understand mangled generic names. genericName = t.FullName; - int bang = genericName.IndexOf(GENERIC_DELIMITER, StringComparison.Ordinal); + int bang = genericName.IndexOf(GENERIC_DELIMITER); if (bang > 0) { genericName = genericName.Substring(0, bang); @@ -2316,7 +2316,7 @@ private static CodeTypeReference GenerateConstructedTypeReference(Type t, string // NOTE: Remove when CodeDom is fixed to understand mangled generic names. string genericName = t.Namespace + DOT + t.Name; - int bang = genericName.IndexOf(GENERIC_DELIMITER, StringComparison.Ordinal); + int bang = genericName.IndexOf(GENERIC_DELIMITER); if (bang > 0) { genericName = genericName.Substring(0, bang); @@ -3492,7 +3492,7 @@ internal string SubClass private const string ANONYMOUS_ENTRYCLASS_PREFIX = "Generated"; private const string DEFINITION_PREFIX = "x"; private const char COMMA = ','; - private const string GENERIC_DELIMITER = "`"; + private const char GENERIC_DELIMITER = '`'; internal const char DOTCHAR = '.'; internal const string DOT = "."; internal const string CODETAG = "Code"; diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/MarkupCompiler/ParserExtension.cs b/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/MarkupCompiler/ParserExtension.cs index f854f1b53ba..284a4e2209d 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/MarkupCompiler/ParserExtension.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/MarkupCompiler/ParserExtension.cs @@ -839,7 +839,7 @@ public override void WriteDefAttribute(XamlDefAttributeNode xamlDefAttributeNode { if (_class == MarkupCompiler.DOT) { - int index = xamlDefAttributeNode.Value.LastIndexOf(MarkupCompiler.DOT, StringComparison.Ordinal); + int index = xamlDefAttributeNode.Value.LastIndexOf(MarkupCompiler.DOTCHAR); ThrowException(SRID.InvalidClassName, MarkupCompiler.DefinitionNSPrefix, CLASS, @@ -869,7 +869,7 @@ public override void WriteDefAttribute(XamlDefAttributeNode xamlDefAttributeNode { if (_subClass == MarkupCompiler.DOT) { - int index = xamlDefAttributeNode.Value.LastIndexOf(MarkupCompiler.DOT, StringComparison.Ordinal); + int index = xamlDefAttributeNode.Value.LastIndexOf(MarkupCompiler.DOTCHAR); ThrowException(SRID.InvalidClassName, MarkupCompiler.DefinitionNSPrefix, SUBCLASS, diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/Tasks/CompilerWrapper.cs b/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/Tasks/CompilerWrapper.cs index d47c9af6ff0..0123a781b0b 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/Tasks/CompilerWrapper.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/Tasks/CompilerWrapper.cs @@ -358,7 +358,7 @@ private void OnSourceFileResolve(Object sender, SourceFileResolveEventArgs e) // // For Xaml Source file, we need to remove the .xaml extension part. // - int fileExtIndex = newRelativeFilePath.LastIndexOf(MarkupCompiler.DOT, StringComparison.Ordinal); + int fileExtIndex = newRelativeFilePath.LastIndexOf(MarkupCompiler.DOTCHAR); newRelativeFilePath = newRelativeFilePath.Substring(0, fileExtIndex); } @@ -408,7 +408,7 @@ private string GetResolvedFilePath(string filePath, ref string newSourceDir) // and put the deepest directory that file is in as the new // SourceDir. // - int pathEndIndex = fullFilePath.LastIndexOf(string.Empty + Path.DirectorySeparatorChar, StringComparison.Ordinal); + int pathEndIndex = fullFilePath.LastIndexOf(Path.DirectorySeparatorChar); newSourceDir = fullFilePath.Substring(0, pathEndIndex + 1); newRelativeFilePath = fullFilePath.Substring(pathEndIndex + 1); diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/MarkupCompilePass1.cs b/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/MarkupCompilePass1.cs index 2aa187e9f48..ac1869ca34b 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/MarkupCompilePass1.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/MarkupCompilePass1.cs @@ -1080,7 +1080,7 @@ private string GetResolvedFilePath(string filePath, ref string newSourceDir) // and put the deepest directory that file is in as the new // SourceDir. // - int pathEndIndex = fullFilePath.LastIndexOf(string.Empty + Path.DirectorySeparatorChar, StringComparison.Ordinal); + int pathEndIndex = fullFilePath.LastIndexOf(Path.DirectorySeparatorChar); newSourceDir = fullFilePath.Substring(0, pathEndIndex + 1); newRelativeFilePath = TaskHelper.GetRootRelativePath(newSourceDir, fullFilePath); diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/MarkupCompilePass2.cs b/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/MarkupCompilePass2.cs index b00d05886dd..cebc9788376 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/MarkupCompilePass2.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/MarkupCompilePass2.cs @@ -545,7 +545,7 @@ private string GetResolvedFilePath(string filePath, ref string newSourceDir) // and put the deepest directory that file is in as the new // SourceDir. // - int pathEndIndex = fullFilePath.LastIndexOf(string.Empty + Path.DirectorySeparatorChar, StringComparison.Ordinal); + int pathEndIndex = fullFilePath.LastIndexOf(Path.DirectorySeparatorChar); newSourceDir = fullFilePath.Substring(0, pathEndIndex + 1); newRelativeFilePath = TaskHelper.GetRootRelativePath(newSourceDir, fullFilePath); diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Command/KeyGesture.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Command/KeyGesture.cs index 69d3bf8518c..6610e1b5287 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Command/KeyGesture.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Command/KeyGesture.cs @@ -253,7 +253,7 @@ internal static void AddGesturesFromResourceStrings(string keyGestures, string d string keyDisplayString; // break apart first gesture from the rest - int index = keyGestures.IndexOf(MULTIPLEGESTURE_DELIMITER, StringComparison.Ordinal); + int index = keyGestures.IndexOf(MULTIPLEGESTURE_DELIMITER); if (index >= 0) { // multiple gestures exist keyGestureToken = keyGestures.Substring(0, index); @@ -266,7 +266,7 @@ internal static void AddGesturesFromResourceStrings(string keyGestures, string d } // similarly, break apart first display string from the rest - index = displayStrings.IndexOf(MULTIPLEGESTURE_DELIMITER, StringComparison.Ordinal); + index = displayStrings.IndexOf(MULTIPLEGESTURE_DELIMITER); if (index >= 0) { // multiple display strings exist keyDisplayString = displayStrings.Substring(0, index); @@ -310,7 +310,7 @@ internal static KeyGesture CreateFromResourceStrings(string keyGestureToken, str private ModifierKeys _modifiers = ModifierKeys.None; private Key _key = Key.None; private string _displayString; - private const string MULTIPLEGESTURE_DELIMITER = ";"; + private const char MULTIPLEGESTURE_DELIMITER = ';'; private static TypeConverter _keyGestureConverter = new KeyGestureConverter(); //private static bool _classRegistered = false; #endregion Private Fields diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/CursorConverter.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/CursorConverter.cs index d00bd087cba..336cbd539bc 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/CursorConverter.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/CursorConverter.cs @@ -113,7 +113,7 @@ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo c if (text != String.Empty) { - if (text.LastIndexOf(".", StringComparison.Ordinal) == -1) + if (text.LastIndexOf('.') == -1) { CursorType ct = (CursorType)Enum.Parse(typeof(CursorType), text); diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/WindowsRuntime/Generated/WinRT.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/WindowsRuntime/Generated/WinRT.cs index 713cdff4773..7d74d32f710 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/WindowsRuntime/Generated/WinRT.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/WindowsRuntime/Generated/WinRT.cs @@ -256,7 +256,7 @@ public BaseActivationFactory(string typeNamespace, string typeFullName) } catch (Exception) { } - var lastSegment = moduleName.LastIndexOf("."); + var lastSegment = moduleName.LastIndexOf('.'); if (lastSegment <= 0) { Marshal.ThrowExceptionForHR(hr); diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/VirtualizingStackPanel.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/VirtualizingStackPanel.cs index 269b64e1cf5..5a9aca1654f 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/VirtualizingStackPanel.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/VirtualizingStackPanel.cs @@ -12378,7 +12378,7 @@ private static TraceList AddToMap(ItemsControl target) } if (filename != "none" && s_seqno > 1) { - int dotIndex = filename.LastIndexOf(".", StringComparison.Ordinal); + int dotIndex = filename.LastIndexOf('.'); if (dotIndex < 0) dotIndex = filename.Length; filename = filename.Substring(0, dotIndex) + s_seqno.ToString() + diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/RtfToXamlReader.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/RtfToXamlReader.cs index 2b000132d13..99af3a0f74d 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/RtfToXamlReader.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/RtfToXamlReader.cs @@ -8238,7 +8238,7 @@ internal void ProcessField() // is very low. Now we replace image with the included picture uri to get // the image directly from the specified Uri. int uriSourceIndex = dnImage.Xaml.IndexOf("UriSource=", StringComparison.Ordinal); - int uriSourceEndIndex = dnImage.Xaml.IndexOf("\"", uriSourceIndex + 11, StringComparison.Ordinal); + int uriSourceEndIndex = dnImage.Xaml.IndexOf('\"', uriSourceIndex + 11); string imageXaml = dnImage.Xaml.Substring(0, uriSourceIndex); imageXaml += "UriSource=\"" + pictureUri + "\""; @@ -8410,7 +8410,7 @@ private string GetIncludePictureUri(string instructionName) { pictureUri = instructionName.Substring(uriIndex, instructionName.Length - uriIndex - 1); - int pictureUriEndIndex = pictureUri.IndexOf("\"", StringComparison.OrdinalIgnoreCase); + int pictureUriEndIndex = pictureUri.IndexOf('\"'); if (pictureUriEndIndex != -1) { pictureUri = pictureUri.Substring(0, pictureUriEndIndex); diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/XamlToRtfWriter.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/XamlToRtfWriter.cs index f1238c48fa2..5bf5bb768e1 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/XamlToRtfWriter.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/XamlToRtfWriter.cs @@ -2231,7 +2231,7 @@ private RtfImageFormat GetImageFormatFromImageSourceName(string imageName) { RtfImageFormat imageFormat = RtfImageFormat.Unknown; - int extensionIndex = imageName.LastIndexOf(".", StringComparison.OrdinalIgnoreCase); + int extensionIndex = imageName.LastIndexOf('.'); if (extensionIndex >= 0) { diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Input/Command/CommandConverter.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Input/Command/CommandConverter.cs index 4752bb5de81..13ec706ac17 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Input/Command/CommandConverter.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Input/Command/CommandConverter.cs @@ -235,7 +235,7 @@ private void ParseUri( string source, out string typeName, out string localName localName = ((string)source).Trim(); // split CommandName from its TypeName (e.g. ScrollViewer.PageDownCommand to Scrollviewerand PageDownCommand) - int Offset = localName.LastIndexOf(".", StringComparison.Ordinal); + int Offset = localName.LastIndexOf('.'); if (Offset >= 0) { typeName = localName.Substring(0, Offset); diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/BamlMapTable.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/BamlMapTable.cs index 73538580e8a..dfac61ecc78 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/BamlMapTable.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/BamlMapTable.cs @@ -1170,7 +1170,7 @@ internal bool GetTypeInfoId( string typeFullName, out short typeId) { - int dotIndex = typeFullName.LastIndexOf(".", StringComparison.Ordinal); + int dotIndex = typeFullName.LastIndexOf('.'); string typeShortName; string typeClrNamespace; if (dotIndex >= 0) diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/BamlReader.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/BamlReader.cs index fdb9daef0bf..f1c67a32547 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/BamlReader.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/BamlReader.cs @@ -392,7 +392,7 @@ public bool MoveToNextProperty() { _name = info.Name; _localName = info.LocalName; - int index = info.Name.LastIndexOf(".", StringComparison.Ordinal); + int index = info.Name.LastIndexOf('.'); if (index > 0) { _ownerTypeName = info.Name.Substring(0, index); @@ -439,7 +439,7 @@ public bool MoveToNextProperty() _connectionId = 0; _prefix = string.Empty; _name = cpInfo.Name; - int index = cpInfo.Name.LastIndexOf(".", StringComparison.Ordinal); + int index = cpInfo.Name.LastIndexOf('.'); if (index > 0) { _ownerTypeName = cpInfo.Name.Substring(0, index); @@ -1305,7 +1305,7 @@ private void ProcessDeferKey() } BamlTypeInfoRecord typeInfo = MapTable.GetTypeInfoFromId(typeKeyRecord.TypeId); string typeName = typeInfo.TypeFullName; - typeName = typeName.Substring(typeName.LastIndexOf(".", StringComparison.Ordinal) + 1); + typeName = typeName.Substring(typeName.LastIndexOf('.') + 1); string assemblyName; string prefix; string xmlNamespace; @@ -1425,7 +1425,7 @@ private BamlKeyInfo ProcessKeyTree() // a x:Key attribute. BamlTypeInfoRecord typeInfo = MapTable.GetTypeInfoFromId(keyStartRecord.TypeId); string markupString = typeInfo.TypeFullName; - markupString = markupString.Substring(markupString.LastIndexOf(".", StringComparison.Ordinal) + 1); + markupString = markupString.Substring(markupString.LastIndexOf('.') + 1); string assemblyName; string prefix; string xmlNamespace; @@ -1552,7 +1552,7 @@ private BamlKeyInfo ProcessKeyTree() BamlElementStartRecord elementStartRecord = _currentBamlRecord as BamlElementStartRecord; BamlTypeInfoRecord elementTypeInfo = MapTable.GetTypeInfoFromId(elementStartRecord.TypeId); string typename = elementTypeInfo.TypeFullName; - typename = typename.Substring(typename.LastIndexOf(".", StringComparison.Ordinal) + 1); + typename = typename.Substring(typename.LastIndexOf('.') + 1); GetAssemblyAndPrefixAndXmlns(elementTypeInfo, out assemblyName, out prefix, out xmlNamespace); if (prefix != string.Empty) { @@ -1964,7 +1964,7 @@ private void ReadElementStartRecord() NodeTypeInternal = BamlNodeType.StartElement; _name = typeInfo.TypeFullName; - _localName = _name.Substring(_name.LastIndexOf(".", StringComparison.Ordinal) + 1); + _localName = _name.Substring(_name.LastIndexOf('.') + 1); _ownerTypeName = string.Empty; _clrNamespace = typeInfo.ClrNamespace; GetAssemblyAndPrefixAndXmlns(typeInfo, out _assemblyName, out _prefix, out _xmlNamespace); @@ -2081,7 +2081,7 @@ private void ReadPropertyComplexStartRecord() // Set instance variables to node info extracted from record. NodeTypeInternal = BamlNodeType.StartComplexProperty; _localName = nodeInfo.LocalName; - int index = nodeInfo.Name.LastIndexOf(".", StringComparison.Ordinal); + int index = nodeInfo.Name.LastIndexOf('.'); if (index > 0) { _ownerTypeName = nodeInfo.Name.Substring(0, index); @@ -2152,7 +2152,7 @@ private void ReadPropertyComplexEndRecord() NodeTypeInternal = BamlNodeType.EndComplexProperty; _name = nodeInfo.Name; _localName = nodeInfo.LocalName; - int index = nodeInfo.Name.LastIndexOf(".", StringComparison.Ordinal); + int index = nodeInfo.Name.LastIndexOf('.'); if (index > 0) { _ownerTypeName = nodeInfo.Name.Substring(0, index); @@ -2409,7 +2409,7 @@ private string GetTemplateBindingExtensionValueString(short memberId) string valueAssemblyName; GetAssemblyAndPrefixAndXmlns(valueTypeInfo, out valueAssemblyName, out valuePrefix, out valueXmlNamespace); typeName = valueTypeInfo.TypeFullName; - typeName = typeName.Substring(typeName.LastIndexOf(".", StringComparison.Ordinal) + 1); + typeName = typeName.Substring(typeName.LastIndexOf('.') + 1); propName = attrInfo.Name; } @@ -2484,7 +2484,7 @@ private string GetStaticExtensionValueString(short memberId) string valueAssemblyName; GetAssemblyAndPrefixAndXmlns(valueTypeInfo, out valueAssemblyName, out valuePrefix, out valueXmlNamespace); typeName = valueTypeInfo.TypeFullName; - typeName = typeName.Substring(typeName.LastIndexOf(".", StringComparison.Ordinal) + 1); + typeName = typeName.Substring(typeName.LastIndexOf('.') + 1); propName = attrInfo.Name; } @@ -2598,7 +2598,7 @@ private string GetTypeValueString(short typeId) string valueAssemblyName; GetAssemblyAndPrefixAndXmlns(valueTypeInfo, out valueAssemblyName, out valuePrefix, out valueXmlNamespace); string typeName = valueTypeInfo.TypeFullName; - typeName = typeName.Substring(typeName.LastIndexOf(".", StringComparison.Ordinal) + 1); + typeName = typeName.Substring(typeName.LastIndexOf('.') + 1); if (valuePrefix == string.Empty) { valueString += typeName; diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/Primitives/MarkupWriter.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/Primitives/MarkupWriter.cs index 5c5e121d4d6..16be0678f53 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/Primitives/MarkupWriter.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/Primitives/MarkupWriter.cs @@ -841,7 +841,7 @@ private void WriteItem(MarkupObject item, Scope scope) writtenAttributes[property.Name] = property.Name; _writer.WriteStartElement(prefix, item.ObjectType.Name + "." + property.PropertyDescriptor.Name, uri); - if (property.IsComposite || property.StringValue.IndexOf("{", StringComparison.Ordinal) == 0) + if (property.IsComposite || property.StringValue.IndexOf('{') == 0) { foreach (MarkupObject subItem in property.Items) { @@ -1649,7 +1649,7 @@ public static string GetDefaultPrefixFor(string uri) result = "assembly"; if (uri.StartsWith(clrUriPrefix, StringComparison.Ordinal)) { - string ns = uri.Substring(clrUriPrefix.Length, uri.IndexOf(";", StringComparison.Ordinal) - clrUriPrefix.Length); + string ns = uri.Substring(clrUriPrefix.Length, uri.IndexOf(';') - clrUriPrefix.Length); StringBuilder r = new StringBuilder(); for (int i = 0; i < ns.Length; i++) { diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/MS/Impl/KnownStrings.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/MS/Impl/KnownStrings.cs index d4057582c21..04afe4a17b4 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/MS/Impl/KnownStrings.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/MS/Impl/KnownStrings.cs @@ -62,6 +62,14 @@ public static bool Eq(string a, string b) return string.Equals(a, b, StringComparison.Ordinal); } + /// + /// Standard String Index search operation. + /// + public static int IndexOf(string src, char value) + { + return src.IndexOf(value); + } + /// /// Standard String Index search operation. /// diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/ClrNamespaceUriParser.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/ClrNamespaceUriParser.cs index 2f32904184e..b5e1994cf91 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/ClrNamespaceUriParser.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/ClrNamespaceUriParser.cs @@ -23,7 +23,7 @@ public static bool TryParseUri(string uriInput, out string clrNs, out string ass // xmlns:bar="clr-namespace:MyAppsNs" // xmlns:spam="clr-namespace:MyAppsNs;assembly=" - int colonIdx = KS.IndexOf(uriInput, ":"); + int colonIdx = KS.IndexOf(uriInput, ':'); if (colonIdx == -1) { return false; @@ -36,7 +36,7 @@ public static bool TryParseUri(string uriInput, out string clrNs, out string ass } int clrNsStartIdx = colonIdx + 1; - int semicolonIdx = KS.IndexOf(uriInput, ";"); + int semicolonIdx = KS.IndexOf(uriInput, ';'); if (semicolonIdx == -1) { clrNs = uriInput.Substring(clrNsStartIdx); @@ -50,7 +50,7 @@ public static bool TryParseUri(string uriInput, out string clrNs, out string ass } int assemblyKeywordStartIdx = semicolonIdx+1; - int equalIdx = KS.IndexOf(uriInput, "="); + int equalIdx = KS.IndexOf(uriInput, '='); if (equalIdx == -1) { return false;