From 2b4a9845486719d1f8fcc1c042fffbdfb7aa25ec Mon Sep 17 00:00:00 2001 From: h3xds1nz Date: Sat, 24 Aug 2024 23:49:30 +0200 Subject: [PATCH] use StringSplitOptions.TrimEntries instead of seprate Trim() (halgab) --- .../System/Windows/Annotations/Annotation.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Annotations/Annotation.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Annotations/Annotation.cs index 11478090c43..d84912a01ef 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Annotations/Annotation.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Annotations/Annotation.cs @@ -637,11 +637,11 @@ private void ReadAttributes(XmlReader reader) case AnnotationXmlConstants.Attributes.TypeName: ReadOnlySpan typeName = value.AsSpan(); - int segmentsLength = typeName.Split(segments, Colon); + int segmentsLength = typeName.Split(segments, Colon, StringSplitOptions.TrimEntries); if (segmentsLength == 1) // Contains only name { - ReadOnlySpan name = typeName[segments[0]].Trim(); + ReadOnlySpan name = typeName[segments[0]]; if (name.IsEmpty) { // Just a string of whitespace (empty string doesn't get processed) @@ -651,8 +651,8 @@ private void ReadAttributes(XmlReader reader) } else if (segmentsLength == 2) //Contains both namespace:name { - ReadOnlySpan @namespace = typeName[segments[0]].Trim(); - ReadOnlySpan name = typeName[segments[1]].Trim(); + ReadOnlySpan @namespace = typeName[segments[0]]; + ReadOnlySpan name = typeName[segments[1]]; if (@namespace.IsEmpty || name.IsEmpty) { // One colon, prefix or suffix is empty string or whitespace