diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/Tasks/CompilerState.cs b/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/Tasks/CompilerState.cs index 72b93dac45d..c807add29eb 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/Tasks/CompilerState.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/Tasks/CompilerState.cs @@ -242,7 +242,7 @@ private static string GenerateStringFromFileNames(ITaskItem[] fileItemList) for (int i = 0; i < fileItemList.Length; i++) { sb.Append(fileItemList[i].ItemSpec); - sb.Append(";"); + sb.Append(';'); } fileNames = sb.ToString(); diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/AppModel/CookieHandler.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/AppModel/CookieHandler.cs index 8f117a38fe7..126219d2cd1 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/AppModel/CookieHandler.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/AppModel/CookieHandler.cs @@ -82,7 +82,7 @@ internal static void HandleWebResponse(WebResponse response) // associated with it. (WebHeaderCollection's internal storage is a string->ArrayList(of string) map.) for (int i = headers.Count-1; i >= 0; i--) { - if (string.Compare(headers.Keys[i], "Set-Cookie", StringComparison.OrdinalIgnoreCase) == 0) + if (string.Equals(headers.Keys[i], "Set-Cookie", StringComparison.OrdinalIgnoreCase)) { string p3pHeader = httpResponse.Headers["P3P"]; foreach (string cookie in headers.GetValues(i)) diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/AppModel/SiteOfOriginContainer.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/AppModel/SiteOfOriginContainer.cs index 89f97fcbb69..4a1e2fa9b2a 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/AppModel/SiteOfOriginContainer.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/AppModel/SiteOfOriginContainer.cs @@ -59,7 +59,7 @@ internal static Uri SiteOfOrigin if (_traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + + Environment.CurrentManagedThreadId + ": SiteOfOriginContainer: returning site of origin " + siteOfOrigin); #endif @@ -230,7 +230,7 @@ protected override PackagePart GetPartCore(Uri uri) if (_traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + + Environment.CurrentManagedThreadId + ": SiteOfOriginContainer: Creating SiteOfOriginPart for Uri " + uri); #endif return new SiteOfOriginPart(this, uri); diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/AppModel/SiteOfOriginPart.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/AppModel/SiteOfOriginPart.cs index 800c8626065..77b011c968f 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/AppModel/SiteOfOriginPart.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/AppModel/SiteOfOriginPart.cs @@ -56,7 +56,7 @@ protected override Stream GetStreamCore(FileMode mode, FileAccess access) if (SiteOfOriginContainer._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + + Environment.CurrentManagedThreadId + ": SiteOfOriginPart: Getting stream."); #endif return GetStreamAndSetContentType(false); @@ -68,7 +68,7 @@ protected override string GetContentTypeCore() if (SiteOfOriginContainer._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + + Environment.CurrentManagedThreadId + ": SiteOfOriginPart: Getting content type."); #endif @@ -96,7 +96,7 @@ private Stream GetStreamAndSetContentType(bool onlyNeedContentType) if (SiteOfOriginContainer._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + + Environment.CurrentManagedThreadId + ": SiteOfOriginPart: Getting content type and using previously determined value"); #endif return null; @@ -112,7 +112,7 @@ private Stream GetStreamAndSetContentType(bool onlyNeedContentType) if (SiteOfOriginContainer._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + + Environment.CurrentManagedThreadId + "SiteOfOriginPart: Using Cached stream"); #endif Stream temp = _cacheStream; @@ -126,7 +126,7 @@ private Stream GetStreamAndSetContentType(bool onlyNeedContentType) if (SiteOfOriginContainer._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + + Environment.CurrentManagedThreadId + ": SiteOfOriginPart: Determining absolute uri for this resource"); #endif string original = Uri.ToString(); @@ -139,7 +139,7 @@ private Stream GetStreamAndSetContentType(bool onlyNeedContentType) if (SiteOfOriginContainer._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + + Environment.CurrentManagedThreadId + ": SiteOfOriginPart: Making web request to " + _absoluteLocation); #endif @@ -165,7 +165,7 @@ private Stream HandleFileSource(bool onlyNeedContentType) if (SiteOfOriginContainer._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + + Environment.CurrentManagedThreadId + ": Opening local file " + _absoluteLocation); #endif if (_contentType == MS.Internal.ContentType.Empty) @@ -189,7 +189,7 @@ private Stream HandleWebSource(bool onlyNeedContentType) if (SiteOfOriginContainer._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + + Environment.CurrentManagedThreadId + ": Successfully retrieved stream from " + _absoluteLocation); #endif @@ -199,7 +199,7 @@ private Stream HandleWebSource(bool onlyNeedContentType) if (SiteOfOriginContainer._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + + Environment.CurrentManagedThreadId + ": SiteOfOriginPart: Setting _contentType"); #endif diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontCache/DWriteFactory.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontCache/DWriteFactory.cs index 20d67d70668..a1cbce3898b 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontCache/DWriteFactory.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontCache/DWriteFactory.cs @@ -74,7 +74,7 @@ private static Text.TextInterface.FontCollection GetFontCollectionFromFileOrFold } // If the directory specifed is the windows fonts directory then no need to reenumerate system fonts. - if (String.Compare(((localPath.Length > 0 && localPath[localPath.Length - 1] != Path.DirectorySeparatorChar) ? localPath + Path.DirectorySeparatorChar : localPath), Util.WindowsFontsUriObject.LocalPath, StringComparison.OrdinalIgnoreCase) == 0) + if (string.Equals((localPath.Length > 0 && localPath[localPath.Length - 1] != Path.DirectorySeparatorChar) ? localPath + Path.DirectorySeparatorChar : localPath, Util.WindowsFontsUriObject.LocalPath, StringComparison.OrdinalIgnoreCase)) { return SystemFontCollection; } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontCache/FamilyCollection.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontCache/FamilyCollection.cs index 35203cd7dae..17511d0e91c 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontCache/FamilyCollection.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontCache/FamilyCollection.cs @@ -140,7 +140,7 @@ internal static bool IsLegacyArabicFont(string familyName) { for (int i = 0; i < _legacyArabicFonts.Length; ++i) { - if (String.Compare(familyName, _legacyArabicFonts[i], StringComparison.OrdinalIgnoreCase) == 0) + if (string.Equals(familyName, _legacyArabicFonts[i], StringComparison.OrdinalIgnoreCase)) { return true; } @@ -270,7 +270,7 @@ private static int GetIndexOfFamily(string familyName) { for (int i = 0; i < _systemCompositeFontsNames.Length; ++i) { - if (String.Compare(_systemCompositeFontsNames[i], familyName, StringComparison.OrdinalIgnoreCase) == 0) + if (string.Equals(_systemCompositeFontsNames[i], familyName, StringComparison.OrdinalIgnoreCase)) { return i; } @@ -396,7 +396,7 @@ ref FontStretch fontStretch else { // store the stripped off style names to look for the specific face later. - potentialFaceName.Insert(0, familyName.Substring(indexOfSpace)); + potentialFaceName.Insert(0, familyName.AsSpan(indexOfSpace)); familyName = familyName.Substring(0, indexOfSpace); } @@ -447,7 +447,7 @@ private CompositeFontFamily LookUpUserCompositeFamily(string familyName) { foreach (KeyValuePair localizedFamilyName in compositeFamily.FamilyNames) { - if (String.Compare(localizedFamilyName.Value, familyName, StringComparison.OrdinalIgnoreCase) == 0) + if (string.Equals(localizedFamilyName.Value, familyName, StringComparison.OrdinalIgnoreCase)) { return compositeFamily; } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontCache/FontCacheUtil.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontCache/FontCacheUtil.cs index 74c9340a7eb..0a6676617bf 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontCache/FontCacheUtil.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontCache/FontCacheUtil.cs @@ -545,7 +545,7 @@ internal static bool IsSupportedFontExtension(string extension, out bool isCompo for (int i = 0; i < SupportedExtensions.Length; ++i) { string supportedExtension = SupportedExtensions[i]; - if (String.Compare(extension, supportedExtension, StringComparison.OrdinalIgnoreCase) == 0) + if (string.Equals(extension, supportedExtension, StringComparison.OrdinalIgnoreCase)) { isComposite = (i == 0); // First array entry is *.CompositeFont return true; @@ -557,7 +557,7 @@ internal static bool IsSupportedFontExtension(string extension, out bool isCompo internal static bool IsCompositeFont(string extension) { - return (String.Compare(extension, CompositeFontExtension, StringComparison.OrdinalIgnoreCase) == 0); + return (string.Equals(extension, CompositeFontExtension, StringComparison.OrdinalIgnoreCase)); } internal static bool IsEnumerableFontUriScheme(Uri fontLocation) diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontFace/FontDifferentiator.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontFace/FontDifferentiator.cs index 5405f85392d..256e6b2d8f0 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontFace/FontDifferentiator.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/FontFace/FontDifferentiator.cs @@ -68,7 +68,7 @@ FontStretch fontStretch { if (faceNameBuilder.Length > 0) { - faceNameBuilder.Append(" "); + faceNameBuilder.Append(' '); } faceNameBuilder.Append(parsedWeightName); } @@ -77,7 +77,7 @@ FontStretch fontStretch { if (faceNameBuilder.Length > 0) { - faceNameBuilder.Append(" "); + faceNameBuilder.Append(' '); } faceNameBuilder.Append(parsedStyleName); } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/IO/Packaging/ByteRangeDownloader.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/IO/Packaging/ByteRangeDownloader.cs index 164505d898a..117b2794a78 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/IO/Packaging/ByteRangeDownloader.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/IO/Packaging/ByteRangeDownloader.cs @@ -417,8 +417,7 @@ private ByteRangeDownloader(Uri requestedUri, SafeWaitHandle eventHandle) } // Ensure uri is correct scheme (http or https) Do case-sensitive comparison since Uri.Scheme contract is to return in lower case only. - if (String.Compare(requestedUri.Scheme, Uri.UriSchemeHttp, StringComparison.Ordinal) != 0 - && String.Compare(requestedUri.Scheme, Uri.UriSchemeHttps, StringComparison.Ordinal) != 0) + if (!string.Equals(requestedUri.Scheme, Uri.UriSchemeHttp, StringComparison.Ordinal) && !string.Equals(requestedUri.Scheme, Uri.UriSchemeHttps, StringComparison.Ordinal)) { throw new ArgumentException(SR.Get(SRID.InvalidScheme), "requestedUri"); } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/IO/Packaging/DeobfuscatingStream.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/IO/Packaging/DeobfuscatingStream.cs index 0018d4048dd..5d64e916601 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/IO/Packaging/DeobfuscatingStream.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/IO/Packaging/DeobfuscatingStream.cs @@ -326,7 +326,7 @@ private static byte[] GetGuidByteArray(string guidString) { // Make sure we have at least on '-' since Guid constructor will take both dash'ed and non-dash'ed format of GUID string // while XPS spec requires dash'ed format of GUID - if (guidString.IndexOf('-') == -1) + if (!guidString.Contains('-')) { throw new ArgumentException(SR.Get(SRID.InvalidPartName)); } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/IO/Packaging/NetStream.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/IO/Packaging/NetStream.cs index 2b6ac50079d..8185d072292 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/IO/Packaging/NetStream.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/IO/Packaging/NetStream.cs @@ -96,8 +96,8 @@ internal NetStream( // only attempt out-of-order requests on well-behaved HTTP servers // (Note: MSDN indicates that uri.Scheme is always lower case) - if (fullStreamLength > 0 && ((String.Compare(uri.Scheme, Uri.UriSchemeHttp, StringComparison.Ordinal) == 0) || - (String.Compare(uri.Scheme, Uri.UriSchemeHttps, StringComparison.Ordinal) == 0))) + if (fullStreamLength > 0 && ((string.Equals(uri.Scheme, Uri.UriSchemeHttp, StringComparison.Ordinal)) || + (string.Equals(uri.Scheme, Uri.UriSchemeHttps, StringComparison.Ordinal)))) { _allowByteRangeRequests = true; _readEventHandles[(int)ReadEvent.ByteRangeReadEvent] = new AutoResetEvent(false); diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/ErasingStroke.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/ErasingStroke.cs index d322a5076c4..a1b7e99f11b 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/ErasingStroke.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/ErasingStroke.cs @@ -340,7 +340,7 @@ private Point[] FilterPoints(Point[] path) // should be further tuned considering trade-off of performance and accuracy. // In general, the larger the value, more points are filtered but less accurate. // For a value of 0.5, typically 70% - 80% percent of the points are filtered out. - private static readonly double CollinearTolerance = 0.1f; + private const double CollinearTolerance = 0.1f; #endregion } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/GestureRecognizer/NativeRecognizer.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/GestureRecognizer/NativeRecognizer.cs index 4dbf871e3ae..80ae950af56 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/GestureRecognizer/NativeRecognizer.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/GestureRecognizer/NativeRecognizer.cs @@ -158,7 +158,7 @@ internal GestureRecognitionResult[] Recognize(StrokeCollection strokes) } // Create an empty result. - GestureRecognitionResult[] recResults = new GestureRecognitionResult[]{}; + GestureRecognitionResult[] recResults = Array.Empty(); if ( strokes.Count == 0 ) { @@ -617,7 +617,7 @@ private void ReleaseResourcesinPacketDescription(MS.Win32.Recognizer.PACKET_DESC /// private GestureRecognitionResult[] InvokeGetAlternateList() { - GestureRecognitionResult[] recResults = new GestureRecognitionResult[] { }; + GestureRecognitionResult[] recResults = Array.Empty(); int hr = 0; MS.Win32.Recognizer.RECO_RANGE recoRange; @@ -681,7 +681,7 @@ private GestureRecognitionResult[] InvokeGetAlternateList() /// private GestureRecognitionResult[] InvokeGetLatticePtr() { - GestureRecognitionResult[] recResults = new GestureRecognitionResult[] { }; + GestureRecognitionResult[] recResults = Array.Empty(); // int hr = 0; IntPtr ptr = IntPtr.Zero; diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/InkSerializedFormat/AlgoModule.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/InkSerializedFormat/AlgoModule.cs index c8edec55548..dca757fc894 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/InkSerializedFormat/AlgoModule.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/InkSerializedFormat/AlgoModule.cs @@ -463,12 +463,12 @@ private LZCodec LZCodec /// /// Static members defined in Penimc code /// - internal static readonly byte NoCompression = 0x00; - internal static readonly byte DefaultCompression = 0xC0; - internal static readonly byte IndexedHuffman = 0x80; - internal static readonly byte LempelZiv = 0x80; - internal static readonly byte DefaultBAACount = 8; - internal static readonly byte MaxBAACount = 10; + internal const byte NoCompression = 0x00; + internal const byte DefaultCompression = 0xC0; + internal const byte IndexedHuffman = 0x80; + internal const byte LempelZiv = 0x80; + internal const byte DefaultBAACount = 8; + internal const byte MaxBAACount = 10; private static readonly double[] DefaultFirstSquareRoot = { 1, 1, 1, 4, 9, 16, 36, 49}; diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/InkSerializedFormat/DrawingAttributeSerializer.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/InkSerializedFormat/DrawingAttributeSerializer.cs index cb9cd859267..3856fb3d672 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/InkSerializedFormat/DrawingAttributeSerializer.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/InkSerializedFormat/DrawingAttributeSerializer.cs @@ -66,11 +66,11 @@ namespace MS.Internal.Ink.InkSerializedFormat /// internal static class DrawingAttributeSerializer { - private static readonly double V1PenWidthWhenWidthIsMissing = 25.0f; - private static readonly double V1PenHeightWhenHeightIsMissing = 25.0f; - private static readonly int TransparencyDefaultV1 = 0; - internal static readonly uint RasterOperationMaskPen = 9; - internal static readonly uint RasterOperationDefaultV1 = 13; + private const double V1PenWidthWhenWidthIsMissing = 25.0f; + private const double V1PenHeightWhenHeightIsMissing = 25.0f; + private const int TransparencyDefaultV1 = 0; + internal const uint RasterOperationMaskPen = 9; + internal const uint RasterOperationDefaultV1 = 13; /// The v1 ISF version of the pen tip shape. For v2, this is represented as StylusShape private enum PenTip diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/InkSerializedFormat/HuffCodec.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/InkSerializedFormat/HuffCodec.cs index fd7475b8998..1ae73d9fbcd 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/InkSerializedFormat/HuffCodec.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/InkSerializedFormat/HuffCodec.cs @@ -266,7 +266,7 @@ internal void Decode(ref int data, ref int extra, BitStreamReader reader) /// /// Private statics /// - private static readonly byte MaxBAASize = 10; + private const byte MaxBAASize = 10; /// /// Private helper class @@ -334,8 +334,8 @@ internal byte GetBitsAtIndex(uint index) /// /// Private statics /// - private static readonly byte MaxBAASize = 10; - private static readonly byte DefaultBAACount = 8; + private const byte MaxBAASize = 10; + private const byte DefaultBAACount = 8; private static readonly byte[][] DefaultBAAData = new byte[][] { new byte[]{0, 1, 2, 4, 6, 8, 12, 16, 24, 32}, diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/InkSerializedFormat/InkSerializer.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/InkSerializedFormat/InkSerializer.cs index 13644e18d66..fdb62ec318d 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/InkSerializedFormat/InkSerializer.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/InkSerializedFormat/InkSerializer.cs @@ -29,8 +29,8 @@ namespace MS.Internal.Ink.InkSerializedFormat internal class StrokeCollectionSerializer { #region Constants (Static Fields) - internal static readonly double AvalonToHimetricMultiplier = 2540.0d / 96.0d; - internal static readonly double HimetricToAvalonMultiplier = 96.0d / 2540.0d; + internal const double AvalonToHimetricMultiplier = 2540.0d / 96.0d; + internal const double HimetricToAvalonMultiplier = 96.0d / 2540.0d; internal static readonly TransformDescriptor IdentityTransformDescriptor; static StrokeCollectionSerializer() diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/InkSerializedFormat/LZCodec.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/InkSerializedFormat/LZCodec.cs index a5d2f5c6089..f631d6451d0 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/InkSerializedFormat/LZCodec.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/InkSerializedFormat/LZCodec.cs @@ -123,8 +123,8 @@ internal byte[] Uncompress(byte[] input, int inputIndex) /// /// Statics / constants /// - private static readonly int FirstMaxMatchLength = 0x10; - private static readonly int RingBufferLength = 4069; - private static readonly int MaxLiteralLength = 2; -} + private const int FirstMaxMatchLength = 0x10; + private const int RingBufferLength = 4069; + private const int MaxLiteralLength = 2; + } } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/Lasso.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/Lasso.cs index 04f3272264f..2075aa6de35 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/Lasso.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/Lasso.cs @@ -537,7 +537,7 @@ protected virtual void AddPointImpl(Point point) private List _points; private Rect _bounds = Rect.Empty; private bool _incrementalLassoDirty = false; - private static readonly double MinDistance = 1.0; + private const double MinDistance = 1.0; #endregion diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/StrokeRenderer.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/StrokeRenderer.cs index b6ea80cabe5..8a0687e21b5 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/StrokeRenderer.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/StrokeRenderer.cs @@ -1122,8 +1122,8 @@ internal static Color GetHighlighterColor(Color color) } // Opacity for highlighter container visuals - internal static readonly double HighlighterOpacity = 0.5; - internal static readonly byte SolidStrokeAlpha = 0xFF; + internal const double HighlighterOpacity = 0.5; + internal const byte SolidStrokeAlpha = 0xFF; internal static readonly Point ArcToMarker = new Point(Double.MinValue, Double.MinValue); /// diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/WpfWebRequestHelper.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/WpfWebRequestHelper.cs index 38b27cfe9bd..2a7773ca647 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/WpfWebRequestHelper.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/WpfWebRequestHelper.cs @@ -58,7 +58,7 @@ internal static WebRequest CreateRequest(Uri uri) // which is mostly for logging and config. // Call PackWebRequestFactory.CreateWebRequest to bypass the regression if possible // by calling Create on PackWebRequest if uri is pack scheme - if (string.Compare(uri.Scheme, PackUriHelper.UriSchemePack, StringComparison.Ordinal) == 0) + if (string.Equals(uri.Scheme, PackUriHelper.UriSchemePack, StringComparison.Ordinal)) { return PackWebRequestFactory.CreateWebRequest(uri); // The PackWebRequest may end up creating a "real" web request as its inner request. @@ -281,8 +281,8 @@ internal static ContentType GetContentType(WebResponse response) MimeTypeMapper.TextPlainMime.AreTypeAndSubTypeEqual(contentType, true)) { string extension = MimeTypeMapper.GetFileExtension(response.ResponseUri); - if ((String.Compare(extension, MimeTypeMapper.XamlExtension, StringComparison.OrdinalIgnoreCase) == 0) || - (String.Compare(extension, MimeTypeMapper.XbapExtension, StringComparison.OrdinalIgnoreCase) == 0)) + if (string.Equals(extension, MimeTypeMapper.XamlExtension, StringComparison.OrdinalIgnoreCase) || + string.Equals(extension, MimeTypeMapper.XbapExtension, StringComparison.OrdinalIgnoreCase)) { contentType = ContentType.Empty; // Will cause GetMimeTypeFromUri to be called below } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/IO/Packaging/PackWebRequest.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/IO/Packaging/PackWebRequest.cs index 73e49185fc8..fabfc8457a7 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/IO/Packaging/PackWebRequest.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/IO/Packaging/PackWebRequest.cs @@ -86,7 +86,7 @@ internal PackWebRequest(Uri uri, Uri packageUri, Uri partUri, Package cacheEntry if (PackWebRequestFactory._traceSwitch.Enabled && (cacheEntry != null)) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + ": " + + Environment.CurrentManagedThreadId + ": " + "PackWebRequest - working from Package Cache"); #endif } @@ -158,7 +158,7 @@ public override WebResponse GetResponse() if (PackWebRequestFactory._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + ": " + + Environment.CurrentManagedThreadId + ": " + "PackWebRequest - Getting response from Package Cache"); #endif return new PackWebResponse(_uri, _innerUri, _partName, _cacheEntry, _cachedPackageIsThreadSafe); @@ -174,7 +174,7 @@ public override WebResponse GetResponse() if (PackWebRequestFactory._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + ": " + + Environment.CurrentManagedThreadId + ": " + "PackWebRequest - Getting new response"); #endif // Create a new response for every call diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/IO/Packaging/PackWebRequestFactory.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/IO/Packaging/PackWebRequestFactory.cs index da4788803bd..7fa6736511d 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/IO/Packaging/PackWebRequestFactory.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/IO/Packaging/PackWebRequestFactory.cs @@ -61,14 +61,14 @@ WebRequest IWebRequestCreate.Create(Uri uri) // Ensure uri is correct scheme because we can be called directly. Case sensitive // is fine because Uri.Scheme contract is to return in lower case only. - if (String.Compare(uri.Scheme, PackUriHelper.UriSchemePack, StringComparison.Ordinal) != 0) + if (!string.Equals(uri.Scheme, PackUriHelper.UriSchemePack, StringComparison.Ordinal)) throw new ArgumentException(SR.Get(SRID.UriSchemeMismatch, PackUriHelper.UriSchemePack), "uri"); #if DEBUG if (_traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + ": " + + Environment.CurrentManagedThreadId + ": " + "PackWebRequestFactory - responding to uri: " + uri); #endif // only inspect cache if part name is present because cache only contains an object, not @@ -107,7 +107,7 @@ WebRequest IWebRequestCreate.Create(Uri uri) if (_traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + ": " + + Environment.CurrentManagedThreadId + ": " + "PackWebRequestFactory - cache hit - returning CachedPackWebRequest"); #endif // use the cached object @@ -120,7 +120,7 @@ WebRequest IWebRequestCreate.Create(Uri uri) if (_traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + ": " + + Environment.CurrentManagedThreadId + ": " + "PackWebRequestFactory - spawning regular PackWebRequest"); #endif return new PackWebRequest(uri, packageUri, partUri); @@ -140,7 +140,7 @@ WebRequest IWebRequestCreate.Create(Uri uri) [FriendAccessAllowed] internal static WebRequest CreateWebRequest(Uri uri) { - if (String.Compare(uri.Scheme, PackUriHelper.UriSchemePack, StringComparison.Ordinal) == 0) + if (string.Equals(uri.Scheme, PackUriHelper.UriSchemePack, StringComparison.Ordinal)) { return ((IWebRequestCreate) _factorySingleton).Create(uri); } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/IO/Packaging/PackWebResponse.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/IO/Packaging/PackWebResponse.cs index 9cea47eebaa..1856eb5c896 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/IO/Packaging/PackWebResponse.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/IO/Packaging/PackWebResponse.cs @@ -78,7 +78,7 @@ internal PackWebResponse(Uri uri, Uri innerUri, Uri partName, WebRequest innerRe if (PackWebRequestFactory._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + ": " + + Environment.CurrentManagedThreadId + ": " + "PackWebResponse - Creating response "); #endif _innerUri = innerUri; @@ -101,7 +101,7 @@ internal PackWebResponse(Uri uri, Uri innerUri, Uri partName, WebRequest innerRe if (PackWebRequestFactory._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + ": " + + Environment.CurrentManagedThreadId + ": " + "PackWebResponse() starting timeout timer " + innerRequest.Timeout + " ms"); #endif _timeoutTimer = new Timer(new TimerCallback(TimeoutCallback), null, innerRequest.Timeout, Timeout.Infinite); @@ -111,7 +111,7 @@ internal PackWebResponse(Uri uri, Uri innerUri, Uri partName, WebRequest innerRe if (PackWebRequestFactory._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + ": " + + Environment.CurrentManagedThreadId + ": " + "PackWebResponse() BeginGetResponse()"); #endif @@ -149,7 +149,7 @@ internal PackWebResponse(Uri uri, Uri innerUri, Uri partName, Package cacheEntry if (PackWebRequestFactory._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + ": " + + Environment.CurrentManagedThreadId + ": " + "PackWebResponse - Creating response from Package Cache"); #endif _uri = uri; @@ -188,7 +188,7 @@ public override Stream GetResponseStream() if (PackWebRequestFactory._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + ": " + + Environment.CurrentManagedThreadId + ": " + "PackWebResponse - GetResponseStream()"); #endif // create and return only a single stream for multiple calls @@ -210,7 +210,7 @@ public override Stream GetResponseStream() if (PackWebRequestFactory._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + ": " + + Environment.CurrentManagedThreadId + ": " + "PackWebResponse - GetResponseStream() - stream length not available - disabling progressive download"); } #endif @@ -502,7 +502,7 @@ protected override void Dispose(bool disposing) if (PackWebRequestFactory._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + ": " + + Environment.CurrentManagedThreadId + ": " + "PackWebResponse.Close()"); #endif // prevent async callback from accessing these resources while we are disposing them @@ -522,7 +522,7 @@ protected override void Dispose(bool disposing) if (PackWebRequestFactory._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + ": " + + Environment.CurrentManagedThreadId + ": " + "PackWebResponse.Close() - close stream"); #endif _responseStream.Close(); @@ -535,7 +535,7 @@ protected override void Dispose(bool disposing) if (PackWebRequestFactory._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + ": " + + Environment.CurrentManagedThreadId + ": " + "PackWebResponse.Close() - close response"); #endif // always call Dispose to satisfy FxCop @@ -561,7 +561,7 @@ protected override void Dispose(bool disposing) if (PackWebRequestFactory._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + ": " + + Environment.CurrentManagedThreadId + ": " + "PackWebResponse.Close() - exiting"); #endif } @@ -620,7 +620,7 @@ internal Stream GetResponseStream() if (PackWebRequestFactory._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + ": " + + Environment.CurrentManagedThreadId + ": " + "CachedResponse - Getting response stream"); #endif // only one copy @@ -637,7 +637,7 @@ internal Stream GetResponseStream() if (PackWebRequestFactory._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + ": " + + Environment.CurrentManagedThreadId + ": " + "CachedResponse - Getting part " + _parent._partName); #endif // open the requested stream @@ -646,7 +646,7 @@ internal Stream GetResponseStream() if (PackWebRequestFactory._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + ": " + + Environment.CurrentManagedThreadId + ": " + "CachedResponse - Getting part stream "); #endif Stream s = p.GetSeekableStream(FileMode.Open, FileAccess.Read); @@ -664,7 +664,7 @@ internal Stream GetResponseStream() if (PackWebRequestFactory._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + ": " + + Environment.CurrentManagedThreadId + ": " + "CachedResponse - Getting part contenttype"); #endif _parent._mimeType = new MS.Internal.ContentType(p.ContentType); @@ -677,7 +677,7 @@ internal Stream GetResponseStream() if (PackWebRequestFactory._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + ": " + + Environment.CurrentManagedThreadId + ": " + "CachedResponse - Length is available from stream"); #endif _parent._fullStreamLength = s.Length; @@ -688,7 +688,7 @@ internal Stream GetResponseStream() if (PackWebRequestFactory._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + ": " + + Environment.CurrentManagedThreadId + ": " + "CachedResponse - Length is not available from stream" + _parent._partName); } #endif @@ -791,7 +791,7 @@ private void ResponseCallback(IAsyncResult ar) if (PackWebRequestFactory._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + ": " + + Environment.CurrentManagedThreadId + ": " + "PackWebResponse.ResponseCallBack()"); #endif // Dispose/Close waits on _responseAvailable so we know that these are available @@ -813,7 +813,7 @@ private void ResponseCallback(IAsyncResult ar) if (PackWebRequestFactory._traceSwitch.Enabled) System.Diagnostics.Trace.TraceError( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + ": " + + Environment.CurrentManagedThreadId + ": " + "PackWebResponse.ResponseCallBack() exception"); #endif // inform other thread of error condition @@ -828,7 +828,7 @@ private void ResponseCallback(IAsyncResult ar) if (PackWebRequestFactory._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + ": " + + Environment.CurrentManagedThreadId + ": " + "PackWebResponse.ResponseCallBack() - signal response available"); #endif @@ -857,7 +857,7 @@ private void WaitForResponse() if (PackWebRequestFactory._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + ": " + + Environment.CurrentManagedThreadId + ": " + "PackWebResponse.WaitForResponse()"); #endif // wait for the response callback @@ -899,7 +899,7 @@ private void TimeoutCallback(Object stateInfo) if (PackWebRequestFactory._traceSwitch.Enabled) System.Diagnostics.Trace.TraceError( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + ": " + + Environment.CurrentManagedThreadId + ": " + "PackWebResponse.TimerCallback() timeout - throwing exception"); #endif // caller is still blocked so need to throw to indicate timeout @@ -914,7 +914,7 @@ private void TimeoutCallback(Object stateInfo) if (PackWebRequestFactory._traceSwitch.Enabled) System.Diagnostics.Trace.TraceInformation( DateTime.Now.ToLongTimeString() + " " + DateTime.Now.Millisecond + " " + - System.Threading.Thread.CurrentThread.ManagedThreadId + ": " + + Environment.CurrentManagedThreadId + ": " + "PackWebResponse.TimerCallback() no timeout - ignoring callback"); } #endif diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/DataFormats.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/DataFormats.cs index 8dd1510fe76..ce009a905f9 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/DataFormats.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/DataFormats.cs @@ -94,7 +94,7 @@ public static DataFormat GetDataFormat(string format) formatItem = (DataFormat)_formatList[n]; - if (String.Compare(formatItem.Name, format, StringComparison.OrdinalIgnoreCase) == 0) + if (string.Equals(formatItem.Name, format, StringComparison.OrdinalIgnoreCase)) { return formatItem; } @@ -274,11 +274,11 @@ public static DataFormat GetDataFormat(string format) /// format is to store the permission set of the source application where the content came from. /// This is then compared at paste time /// - internal static readonly string ApplicationTrust = "ApplicationTrust"; + internal const string ApplicationTrust = "ApplicationTrust"; + + internal const string FileName = "FileName"; + internal const string FileNameW = "FileNameW"; - internal static readonly string FileName = "FileName"; - internal static readonly string FileNameW = "FileNameW"; - #endregion Internal Fields //------------------------------------------------------ diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Ink/ApplicationGesture.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Ink/ApplicationGesture.cs index 5bc259e384a..27c03e38f76 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Ink/ApplicationGesture.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Ink/ApplicationGesture.cs @@ -200,7 +200,7 @@ internal static class ApplicationGestureHelper { // the number of enums defined, used by NativeRecognizer // to limit input - internal static readonly int CountOfValues = 44; + internal const int CountOfValues = 44; // Helper like Enum.IsDefined, for ApplicationGesture. It is an fxcop violation // to use Enum.IsDefined (for perf reasons) diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Ink/DrawingAttributes.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Ink/DrawingAttributes.cs index 6c22f13d587..fe271d580bf 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Ink/DrawingAttributes.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Ink/DrawingAttributes.cs @@ -1030,9 +1030,9 @@ private void OnPropertyChanged(string propertyName) /// /// Statics /// - internal static readonly float StylusPrecision = 1000.0f; - internal static readonly double DefaultWidth = 2.0031496062992127; - internal static readonly double DefaultHeight = 2.0031496062992127; + internal const float StylusPrecision = 1000.0f; + internal const double DefaultWidth = 2.0031496062992127; + internal const double DefaultHeight = 2.0031496062992127; #endregion diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Ink/GestureRecognizer.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Ink/GestureRecognizer.cs index b9f7670b55d..b6fbd4f06e6 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Ink/GestureRecognizer.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Ink/GestureRecognizer.cs @@ -131,7 +131,7 @@ public ReadOnlyCollection GetEnabledGestures() //can be null if the call to SetEnabledGestures failed if (_enabledGestures == null) { - _enabledGestures = new ApplicationGesture[] { }; + _enabledGestures = Array.Empty(); } return new ReadOnlyCollection(_enabledGestures); } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Ink/Stroke2.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Ink/Stroke2.cs index 7a5e9816956..d7e48e59e15 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Ink/Stroke2.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Ink/Stroke2.cs @@ -754,7 +754,7 @@ private static void CalcHollowTransforms(DrawingAttributes originalDa, out Matri private bool _drawAsHollow = false; private bool _cloneStylusPoints = true; private bool _delayRaiseInvalidated = false; - private static readonly double HollowLineSize = 1.0f; + private const double HollowLineSize = 1.0f; private Rect _cachedBounds = Rect.Empty; // The private PropertyChanged event @@ -765,7 +765,7 @@ private static void CalcHollowTransforms(DrawingAttributes originalDa, out Matri #endregion - internal static readonly double PercentageTolerance = 0.0001d; + internal const double PercentageTolerance = 0.0001d; #endregion } } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Command/MouseBinding.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Command/MouseBinding.cs index dfe3c0610e8..7c92fa5f07f 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Command/MouseBinding.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Command/MouseBinding.cs @@ -228,7 +228,7 @@ private void SynchronizeGestureFromProperties(MouseAction mouseAction) private void OnMouseGesturePropertyChanged(object sender, PropertyChangedEventArgs e) { - if (string.Compare(e.PropertyName, "MouseAction", StringComparison.Ordinal) == 0) + if (string.Equals(e.PropertyName, "MouseAction", StringComparison.Ordinal)) { MouseGesture mouseGesture = Gesture as MouseGesture; if (mouseGesture != null) diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Common/RawStylusActions.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Common/RawStylusActions.cs index c3d4282b364..44015aefaf5 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Common/RawStylusActions.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Common/RawStylusActions.cs @@ -72,7 +72,7 @@ internal enum RawStylusActions /// internal static class RawStylusActionsHelper { - private static readonly RawStylusActions MaxActions = + private const RawStylusActions MaxActions = RawStylusActions.None | RawStylusActions.Activate | RawStylusActions.Deactivate | diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Common/RawStylusSystemGestureInputReport.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Common/RawStylusSystemGestureInputReport.cs index ca927a20d06..66f670633ea 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Common/RawStylusSystemGestureInputReport.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Common/RawStylusSystemGestureInputReport.cs @@ -101,7 +101,7 @@ internal RawStylusSystemGestureInputReport( : base(mode, timestamp, inputSource, RawStylusActions.SystemGesture, stylusPointDescGenerator, tabletId, - stylusDeviceId, new int[] { }) + stylusDeviceId, Array.Empty()) { Initialize(systemGesture, gestureX, gestureY, buttonState); } @@ -151,7 +151,7 @@ internal RawStylusSystemGestureInputReport( int gestureX, int gestureY, int buttonState) - : base(mode, timestamp, inputSource, penContext, RawStylusActions.SystemGesture, tabletId, stylusDeviceId, new int[] { }) + : base(mode, timestamp, inputSource, penContext, RawStylusActions.SystemGesture, tabletId, stylusDeviceId, Array.Empty()) { Initialize(systemGesture, gestureX, gestureY, buttonState); } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Common/StylusPoint.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Common/StylusPoint.cs index b384391bd4b..2e760aae830 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Common/StylusPoint.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Common/StylusPoint.cs @@ -22,7 +22,7 @@ namespace System.Windows.Input /// public struct StylusPoint : IEquatable { - internal static readonly float DefaultPressure = 0.5f; + internal const float DefaultPressure = 0.5f; private double _x; diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Common/StylusPointDescription.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Common/StylusPointDescription.cs index ed9ad290179..ed65fec0005 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Common/StylusPointDescription.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Common/StylusPointDescription.cs @@ -25,11 +25,11 @@ public class StylusPointDescription /// /// Internal statics for our magic numbers /// - internal static readonly int RequiredCountOfProperties = 3; - internal static readonly int RequiredXIndex = 0; - internal static readonly int RequiredYIndex = 1; - internal static readonly int RequiredPressureIndex = 2; - internal static readonly int MaximumButtonCount = 31; + internal const int RequiredCountOfProperties = 3; + internal const int RequiredXIndex = 0; + internal const int RequiredYIndex = 1; + internal const int RequiredPressureIndex = 2; + internal const int MaximumButtonCount = 31; private int _buttonCount = 0; private int _originalPressureIndex = RequiredPressureIndex; diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Common/StylusTraceLogger.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Common/StylusTraceLogger.cs index fa229de8219..18705220697 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Common/StylusTraceLogger.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Common/StylusTraceLogger.cs @@ -155,42 +155,42 @@ internal class StylusErrorEventData /// /// Event name for logging datagrid usage details /// - private static readonly string StartupEventTag = "StylusStartup"; + private const string StartupEventTag = "StylusStartup"; /// /// Event name for logging datagrid usage details /// - private static readonly string ShutdownEventTag = "StylusShutdown"; + private const string ShutdownEventTag = "StylusShutdown"; /// /// Event name for logging datagrid usage details /// - private static readonly string StatisticsTag = "StylusStatistics"; + private const string StatisticsTag = "StylusStatistics"; /// /// Event name for a stylus error /// - private static readonly string ErrorTag = "StylusError"; + private const string ErrorTag = "StylusError"; /// /// Event name for a stylus connection /// - private static readonly string DeviceConnectTag = "StylusConnect"; + private const string DeviceConnectTag = "StylusConnect"; /// /// Event name for a stylus disconnection /// - private static readonly string DeviceDisconnectTag = "StylusDisconnect"; + private const string DeviceDisconnectTag = "StylusDisconnect"; /// /// Event name for a stylus disconnection /// - private static readonly string ReentrancyTag = "StylusReentrancy"; + private const string ReentrancyTag = "StylusReentrancy"; /// /// Event name for the retry limits on re-entrancy into the touch stack being reached /// - private static readonly string ReentrancyRetryLimitTag = "StylusReentrancyRetryLimitReached"; + private const string ReentrancyRetryLimitTag = "StylusReentrancyRetryLimitReached"; #endregion diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Wisp/PenContexts.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Wisp/PenContexts.cs index 9b2577b6497..f98c48b0632 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Wisp/PenContexts.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Stylus/Wisp/PenContexts.cs @@ -126,7 +126,7 @@ internal void OnPenInRange(PenContext penContext, int tabletDeviceId, int stylus internal void OnPenOutOfRange(PenContext penContext, int tabletDeviceId, int stylusPointerId, int timestamp) { - ProcessInput(RawStylusActions.OutOfRange, penContext, tabletDeviceId, stylusPointerId, new int[]{}, timestamp); + ProcessInput(RawStylusActions.OutOfRange, penContext, tabletDeviceId, stylusPointerId, Array.Empty(), timestamp); } ///////////////////////////////////////////////////////////////////// diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/InterOp/HwndSourceParameters.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/InterOp/HwndSourceParameters.cs index dadb2559453..fe921e592da 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/InterOp/HwndSourceParameters.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/InterOp/HwndSourceParameters.cs @@ -424,7 +424,7 @@ internal static bool PlatformSupportsTransparentChildWindows /// Not intended to be tested outside test code internal static void SetPlatformSupportsTransparentChildWindowsForTestingOnly(bool value) { - if (string.Compare(System.Reflection.Assembly.GetEntryAssembly().GetName().Name, "drthwndsource", true) == 0) + if (string.Equals(System.Reflection.Assembly.GetEntryAssembly().GetName().Name, "drthwndsource", StringComparison.CurrentCultureIgnoreCase)) { _platformSupportsTransparentChildWindows = value; } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Animation/Timeline.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Animation/Timeline.cs index 2d52535a990..391fb9db240 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Animation/Timeline.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Animation/Timeline.cs @@ -1088,7 +1088,7 @@ internal void BuildInfo(System.Text.StringBuilder builder, int depth, bool inclu { builder.Append(", Name=\""); builder.Append(Name); - builder.Append("\""); + builder.Append('"'); } if (AccelerationRatio != 0.0f) { diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/ColorContext.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/ColorContext.cs index 150c16e2b98..2771a5142a4 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/ColorContext.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/ColorContext.cs @@ -834,9 +834,9 @@ private void FromRawBytes(byte[] data, int dataLength, bool dontThrowException) NativeMethods.COLORTYPE.COLOR_8_CHANNEL }; - private readonly static string _colorProfileResources = "ColorProfiles"; + private const string _colorProfileResources = "ColorProfiles"; - private readonly static string _sRGBProfileName = "sRGB_icm"; + private const string _sRGBProfileName = "sRGB_icm"; [StructLayout(LayoutKind.Sequential)] private struct AbbreviatedPROFILEHEADER diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Generated/DoubleCollection.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Generated/DoubleCollection.cs index 7e413752738..02da940b060 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Generated/DoubleCollection.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Generated/DoubleCollection.cs @@ -723,7 +723,7 @@ internal string ConvertToString(string format, IFormatProvider provider) if (i != _collection.Count-1) { - str.Append(" "); + str.Append(' '); } } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Generated/GradientStopCollection.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Generated/GradientStopCollection.cs index ae4efac9645..ae4c4ba1ad7 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Generated/GradientStopCollection.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Generated/GradientStopCollection.cs @@ -803,7 +803,7 @@ internal string ConvertToString(string format, IFormatProvider provider) if (i != _collection.Count-1) { - str.Append(" "); + str.Append(' '); } } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Generated/Int32Collection.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Generated/Int32Collection.cs index 25ee437cc9d..b3befd189f9 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Generated/Int32Collection.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Generated/Int32Collection.cs @@ -723,7 +723,7 @@ internal string ConvertToString(string format, IFormatProvider provider) if (i != _collection.Count-1) { - str.Append(" "); + str.Append(' '); } } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Generated/PathFigureCollection.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Generated/PathFigureCollection.cs index 85abee82f6e..7858217789c 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Generated/PathFigureCollection.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Generated/PathFigureCollection.cs @@ -804,7 +804,7 @@ internal string ConvertToString(string format, IFormatProvider provider) if (i != _collection.Count-1) { - str.Append(" "); + str.Append(' '); } } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Generated/PointCollection.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Generated/PointCollection.cs index 36af23eddc4..2de38f249e1 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Generated/PointCollection.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Generated/PointCollection.cs @@ -723,7 +723,7 @@ internal string ConvertToString(string format, IFormatProvider provider) if (i != _collection.Count-1) { - str.Append(" "); + str.Append(' '); } } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Generated/VectorCollection.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Generated/VectorCollection.cs index cddc8865043..f69cf52d1bb 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Generated/VectorCollection.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Generated/VectorCollection.cs @@ -723,7 +723,7 @@ internal string ConvertToString(string format, IFormatProvider provider) if (i != _collection.Count-1) { - str.Append(" "); + str.Append(' '); } } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Imaging/BitmapDecoder.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Imaging/BitmapDecoder.cs index 8425e15feac..cdb3bf0a29c 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Imaging/BitmapDecoder.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Imaging/BitmapDecoder.cs @@ -1053,7 +1053,7 @@ out SafeFileHandle safeFilehandle if (uri.IsAbsoluteUri) { // This code path executes only for pack web requests - if (String.Compare(uri.Scheme, PackUriHelper.UriSchemePack, StringComparison.OrdinalIgnoreCase) == 0) + if (string.Equals(uri.Scheme, PackUriHelper.UriSchemePack, StringComparison.OrdinalIgnoreCase)) { WebResponse response = WpfWebRequestHelper.CreateRequestAndGetResponse(uri); bitmapStream = response.GetResponseStream(); diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/MatrixStack.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/MatrixStack.cs index 2dbaa359e4e..b288a389a37 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/MatrixStack.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/MatrixStack.cs @@ -16,20 +16,20 @@ namespace System.Windows.Media internal class MatrixStack { private Matrix[] _items; - private int _size; - + private int _size; + #if DEBUG - private static readonly int s_initialSize = 4; + private const int s_initialSize = 4; #else private static readonly int s_initialSize = 40; // sizeof(Matrix) * 40 = 2240 bytes. Must be > 4 #endif - private static readonly int s_growFactor = 2; - private static readonly int s_shrinkFactor = s_growFactor + 1; + private const int s_growFactor = 2; + private const int s_shrinkFactor = s_growFactor + 1; // The following members are used to lazily manage the memory allocated by the stack. private int _highWaterMark; private int _observeCount; - private static readonly int s_trimCount = 10; + private const int s_trimCount = 10; public MatrixStack() { diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media3D/Generated/Point3DCollection.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media3D/Generated/Point3DCollection.cs index aa0e15ba412..3e0107cda01 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media3D/Generated/Point3DCollection.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media3D/Generated/Point3DCollection.cs @@ -719,7 +719,7 @@ internal string ConvertToString(string format, IFormatProvider provider) if (i != _collection.Count-1) { - str.Append(" "); + str.Append(' '); } } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media3D/Generated/Vector3DCollection.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media3D/Generated/Vector3DCollection.cs index 4ef06ea1c92..feb09d4145f 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media3D/Generated/Vector3DCollection.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media3D/Generated/Vector3DCollection.cs @@ -719,7 +719,7 @@ internal string ConvertToString(string format, IFormatProvider provider) if (i != _collection.Count-1) { - str.Append(" "); + str.Append(' '); } } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Navigation/BaseUriHelper.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Navigation/BaseUriHelper.cs index 29f0148a097..e79bd709b7d 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Navigation/BaseUriHelper.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Navigation/BaseUriHelper.cs @@ -195,7 +195,7 @@ internal static void GetAssemblyAndPartNameFromPackAppUri(Uri uri, out Assembly assembly = ResourceAssembly; // The partName returned from GetAssemblyNameAndPart should be escaped. - Debug.Assert(String.Compare(partName, uri.GetComponents(UriComponents.Path, UriFormat.UriEscaped), StringComparison.OrdinalIgnoreCase) == 0); + Debug.Assert(string.Equals(partName, uri.GetComponents(UriComponents.Path, UriFormat.UriEscaped), StringComparison.OrdinalIgnoreCase)); } else { @@ -347,7 +347,7 @@ static internal bool IsComponentEntryAssembly(string component) if (assembly != null) { - return (String.Compare(SafeSecurityHelper.GetAssemblyPartialName(assembly), assemblyName, StringComparison.OrdinalIgnoreCase) == 0); + return (string.Equals(SafeSecurityHelper.GetAssemblyPartialName(assembly), assemblyName, StringComparison.OrdinalIgnoreCase)); } else { @@ -370,7 +370,7 @@ static internal Uri MakeRelativeToSiteOfOriginIfPossible(Uri sUri) if (Uri.Compare(sUri, SiteOfOriginBaseUri, UriComponents.Scheme, UriFormat.UriEscaped, StringComparison.OrdinalIgnoreCase) == 0) { Uri packageUri = PackUriHelper.GetPackageUri(sUri); - if (String.Compare(packageUri.GetComponents(UriComponents.AbsoluteUri, UriFormat.UriEscaped), _packageSiteOfOriginBaseUriEscaped, StringComparison.OrdinalIgnoreCase) == 0) + if (string.Equals(packageUri.GetComponents(UriComponents.AbsoluteUri, UriFormat.UriEscaped), _packageSiteOfOriginBaseUriEscaped, StringComparison.OrdinalIgnoreCase)) { return (new Uri(sUri.GetComponents(UriComponents.SchemeAndServer, UriFormat.UriEscaped))).MakeRelativeUri(sUri); } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/Data/RBNode.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/Data/RBNode.cs index ce0ea3ff100..7306f3519ad 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/Data/RBNode.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/Data/RBNode.cs @@ -774,22 +774,24 @@ protected bool Verify(RBNode node, Comparison comparison, int blackDepth, protected void SaveTree(RBNode node, StringBuilder sb) { if (node == null) + { sb.Append("()"); + } else { - sb.Append("("); + sb.Append('('); sb.Append(node.IsRed ? 'T' : 'F'); sb.Append(node.LeftSize); - sb.Append(","); + sb.Append(','); sb.Append(node.Size); for (int k = 0; k < node.Size; ++k) { - sb.Append(","); + sb.Append(','); sb.Append(AsInt(node.GetItemAt(k))); } SaveTree(node.LeftChild, sb); SaveTree(node.RightChild, sb); - sb.Append(")"); + sb.Append(')'); } } 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 bec9fcdb559..34591261c97 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 @@ -12262,7 +12262,7 @@ private static string DisplayType(object o) { if (needSeparator) { - sb.Append("/"); + sb.Append('/'); } ReadOnlySpan name = t.ToString(); @@ -12560,9 +12560,7 @@ private static TraceList AddToMap(ItemsControl target) { int dotIndex = filename.LastIndexOf('.'); if (dotIndex < 0) dotIndex = filename.Length; - filename = filename.Substring(0, dotIndex) + - s_seqno.ToString() + - filename.Substring(dotIndex); + filename = $"{filename.AsSpan(0, dotIndex)}{s_seqno}{filename.AsSpan(dotIndex)}"; } // create the TraceList diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Data/Binding.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Data/Binding.cs index 0dd5020a668..140a55d6cf7 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Data/Binding.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Data/Binding.cs @@ -779,7 +779,7 @@ internal bool TreeContextIsRequired treeContextIsRequired = (_attachedPropertiesInPath > 0); // namespace prefixes in the XPath need an XmlNamespaceManager - if (!treeContextIsRequired && HasValue(Feature.XPath) && XPath.IndexOf(':') >= 0) + if (!treeContextIsRequired && HasValue(Feature.XPath) && XPath.Contains(':')) { treeContextIsRequired = true; } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/FixedSOMFixedBlock.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/FixedSOMFixedBlock.cs index 131f945e4d3..67206c6163a 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/FixedSOMFixedBlock.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/FixedSOMFixedBlock.cs @@ -224,7 +224,7 @@ public override string ToString() if (run != null) { builder.Append(run.Text); - builder.Append(" "); + builder.Append(' '); } } return builder.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 ed9155855d5..32a1f5529e7 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 @@ -275,7 +275,7 @@ internal static bool StringToInt(ReadOnlySpan s, ref int i) internal static string StringToXMLAttribute(string s) { - if (s.IndexOf('"') == -1) + if (!s.Contains('"')) { return s; } @@ -493,7 +493,7 @@ private static string MarkerRomanCountToString(StringBuilder sb, MarkerStyle ms, { while (nCount >= 1000) { - sb.Append("M"); + sb.Append('M'); nCount -= 1000; } @@ -509,7 +509,7 @@ private static string MarkerRomanCountToString(StringBuilder sb, MarkerStyle ms, case 6: sb.Append("DC"); break; case 5: - sb.Append("D"); break; + sb.Append('D'); break; case 4: sb.Append("CD"); break; case 3: @@ -517,7 +517,7 @@ private static string MarkerRomanCountToString(StringBuilder sb, MarkerStyle ms, case 2: sb.Append("CC"); break; case 1: - sb.Append("C"); break; + sb.Append('C'); break; case 0: break; } @@ -535,7 +535,7 @@ private static string MarkerRomanCountToString(StringBuilder sb, MarkerStyle ms, case 6: sb.Append("LX"); break; case 5: - sb.Append("L"); break; + sb.Append('L'); break; case 4: sb.Append("XL"); break; case 3: @@ -543,7 +543,7 @@ private static string MarkerRomanCountToString(StringBuilder sb, MarkerStyle ms, case 2: sb.Append("XX"); break; case 1: - sb.Append("X"); break; + sb.Append('X'); break; case 0: break; } @@ -561,7 +561,7 @@ private static string MarkerRomanCountToString(StringBuilder sb, MarkerStyle ms, case 6: sb.Append("VI"); break; case 5: - sb.Append("V"); break; + sb.Append('V'); break; case 4: sb.Append("IV"); break; case 3: @@ -569,7 +569,7 @@ private static string MarkerRomanCountToString(StringBuilder sb, MarkerStyle ms, case 2: sb.Append("II"); break; case 1: - sb.Append("I"); break; + sb.Append('I'); break; case 0: break; } @@ -2144,14 +2144,14 @@ internal string GetBorderAttributeString(ConverterState converterState) else { sb.Append(Converters.TwipToPositiveVisiblePxString(BorderLeft.EffectiveWidth)); - sb.Append(","); + sb.Append(','); sb.Append(Converters.TwipToPositiveVisiblePxString(BorderTop.EffectiveWidth)); - sb.Append(","); + sb.Append(','); sb.Append(Converters.TwipToPositiveVisiblePxString(BorderRight.EffectiveWidth)); - sb.Append(","); + sb.Append(','); sb.Append(Converters.TwipToPositiveVisiblePxString(BorderBottom.EffectiveWidth)); } - sb.Append("\""); + sb.Append('"'); ColorTableEntry entry = null; if (CF >= 0) @@ -2163,7 +2163,7 @@ internal string GetBorderAttributeString(ConverterState converterState) { sb.Append(" BorderBrush=\""); sb.Append(entry.Color.ToString()); - sb.Append("\""); + sb.Append('"'); } else { @@ -2174,7 +2174,7 @@ internal string GetBorderAttributeString(ConverterState converterState) { sb.Append(" Padding=\""); sb.Append(Converters.TwipToPositivePxString(Spacing)); - sb.Append("\""); + sb.Append('"'); } return sb.ToString(); @@ -2715,13 +2715,13 @@ internal string GetBorderAttributeString(ConverterState converterState) // Left,Top,Right,Bottom sb.Append(" BorderThickness=\""); sb.Append(Converters.TwipToPositiveVisiblePxString(BorderLeft.EffectiveWidth)); - sb.Append(","); + sb.Append(','); sb.Append(Converters.TwipToPositiveVisiblePxString(BorderTop.EffectiveWidth)); - sb.Append(","); + sb.Append(','); sb.Append(Converters.TwipToPositiveVisiblePxString(BorderRight.EffectiveWidth)); - sb.Append(","); + sb.Append(','); sb.Append(Converters.TwipToPositiveVisiblePxString(BorderBottom.EffectiveWidth)); - sb.Append("\""); + sb.Append('"'); // Only grab one color ColorTableEntry entry = null; @@ -2734,7 +2734,7 @@ internal string GetBorderAttributeString(ConverterState converterState) { sb.Append(" BorderBrush=\""); sb.Append(entry.Color.ToString(CultureInfo.InvariantCulture)); - sb.Append("\""); + sb.Append('"'); } else { @@ -4805,7 +4805,7 @@ internal void AppendXamlFontProperties(ConverterState converterState, StringBuil { sb.Append("Strikethrough"); } - sb.Append("\""); + sb.Append('"'); } if (fsThis.Font != fsParent.Font && fsThis.Font >= 0) @@ -4828,7 +4828,7 @@ internal void AppendXamlFontProperties(ConverterState converterState, StringBuil sb.Append(entry.Name); } - sb.Append("\""); + sb.Append('"'); } } @@ -4876,7 +4876,7 @@ internal void AppendXamlFontProperties(ConverterState converterState, StringBuil { sb.Append(" Foreground=\""); sb.Append(entry.Color.ToString()); - sb.Append("\""); + sb.Append('"'); } } @@ -4888,7 +4888,7 @@ internal void AppendXamlFontProperties(ConverterState converterState, StringBuil CultureInfo ci = new CultureInfo((int)fsThis.LangCur); sb.Append(" xml:lang=\""); sb.Append(ci.Name); - sb.Append("\""); + sb.Append('"'); } catch (System.ArgumentException) { @@ -4992,7 +4992,7 @@ internal void AppendXamlEncoded(string text) xamlStringBuilder.Append("&#x"); int ic = (int)text[currentIndex]; xamlStringBuilder.Append(ic.ToString("x", CultureInfo.InvariantCulture)); - xamlStringBuilder.Append(";"); + xamlStringBuilder.Append(';'); break; default: @@ -5043,13 +5043,13 @@ internal void AppendXamlPrefix(ConverterState converterState) // Do I need to wrap a font around this? if (IsEmptyNode && RequiresXamlFontProperties()) { - xamlStringBuilder.Append("<"); + xamlStringBuilder.Append('<'); xamlStringBuilder.Append(XamlNames[(int)DocumentNodeType.dnInline]); AppendXamlFontProperties(converterState, xamlStringBuilder); - xamlStringBuilder.Append(">"); + xamlStringBuilder.Append('>'); } - xamlStringBuilder.Append("<"); + xamlStringBuilder.Append('<'); xamlStringBuilder.Append(GetTagName()); switch (Type) @@ -5088,14 +5088,14 @@ internal void AppendXamlPrefix(ConverterState converterState) xamlStringBuilder.Append(" /"); } - xamlStringBuilder.Append(">"); + xamlStringBuilder.Append('>'); // Do I need to wrap a font around this? if (IsEmptyNode && RequiresXamlFontProperties()) { xamlStringBuilder.Append(""); + xamlStringBuilder.Append('>'); } // Anything after the start tag? @@ -5123,7 +5123,7 @@ private void AppendXamlPrefixTableProperties(StringBuilder xamlStringBuilder) CellFormat cf = rf.RowCellFormat; xamlStringBuilder.Append(" CellSpacing=\""); xamlStringBuilder.Append(Converters.TwipToPositiveVisiblePxString(cf.SpacingLeft)); - xamlStringBuilder.Append("\""); + xamlStringBuilder.Append('"'); xamlStringBuilder.Append(" Margin=\""); xamlStringBuilder.Append(Converters.TwipToPositivePxString(rf.Trleft)); xamlStringBuilder.Append(",0,0,0\""); @@ -5152,7 +5152,7 @@ private void AppendXamlPrefixCellProperties(StringBuilder xamlStringBuilder, Doc { xamlStringBuilder.Append(" Background=\""); xamlStringBuilder.Append(cToUse.ToString(CultureInfo.InvariantCulture)); - xamlStringBuilder.Append("\""); + xamlStringBuilder.Append('"'); } if (cf.HasBorder) @@ -5168,13 +5168,13 @@ private void AppendXamlPrefixCellProperties(StringBuilder xamlStringBuilder, Doc { xamlStringBuilder.Append(" ColumnSpan=\""); xamlStringBuilder.Append(ColSpan.ToString(CultureInfo.InvariantCulture)); - xamlStringBuilder.Append("\""); + xamlStringBuilder.Append('"'); } if (RowSpan > 1) { xamlStringBuilder.Append(" RowSpan=\""); xamlStringBuilder.Append(RowSpan.ToString(CultureInfo.InvariantCulture)); - xamlStringBuilder.Append("\""); + xamlStringBuilder.Append('"'); } } @@ -5202,7 +5202,7 @@ private void AppendXamlPrefixParagraphProperties(StringBuilder xamlStringBuilder { xamlStringBuilder.Append(" Background=\""); xamlStringBuilder.Append(cToUse.ToString(CultureInfo.InvariantCulture)); - xamlStringBuilder.Append("\""); + xamlStringBuilder.Append('"'); } // Handle paragraph direction @@ -5211,13 +5211,13 @@ private void AppendXamlPrefixParagraphProperties(StringBuilder xamlStringBuilder // Handle paragraph margins xamlStringBuilder.Append(" Margin=\""); xamlStringBuilder.Append(Converters.TwipToPositivePxString(NearMargin)); - xamlStringBuilder.Append(","); + xamlStringBuilder.Append(','); xamlStringBuilder.Append(Converters.TwipToPositivePxString(fsThis.SB)); - xamlStringBuilder.Append(","); + xamlStringBuilder.Append(','); xamlStringBuilder.Append(Converters.TwipToPositivePxString(FarMargin)); - xamlStringBuilder.Append(","); + xamlStringBuilder.Append(','); xamlStringBuilder.Append(Converters.TwipToPositivePxString(fsThis.SA)); - xamlStringBuilder.Append("\""); + xamlStringBuilder.Append('"'); // FontFamily, Size, Bold, Italic AppendXamlFontProperties(converterState, xamlStringBuilder); @@ -5235,7 +5235,7 @@ private void AppendXamlPrefixParagraphProperties(StringBuilder xamlStringBuilder // xamlStringBuilder.Append(" LineHeight=\""); // xamlStringBuilder.Append(Converters.TwipToPxString(px)); - // xamlStringBuilder.Append("\""); + // xamlStringBuilder.Append('"'); //} // Indent @@ -5243,7 +5243,7 @@ private void AppendXamlPrefixParagraphProperties(StringBuilder xamlStringBuilder { xamlStringBuilder.Append(" TextIndent=\""); xamlStringBuilder.Append(Converters.TwipToPxString(fsThis.FI)); - xamlStringBuilder.Append("\""); + xamlStringBuilder.Append('"'); } // Handle paragraph alignment @@ -5251,7 +5251,7 @@ private void AppendXamlPrefixParagraphProperties(StringBuilder xamlStringBuilder { xamlStringBuilder.Append(" TextAlignment=\""); xamlStringBuilder.Append(Converters.AlignmentToString(fsThis.HAlign, fsThis.DirPara)); - xamlStringBuilder.Append("\""); + xamlStringBuilder.Append('"'); } // Handle paragraph borders @@ -5293,14 +5293,14 @@ private void AppendXamlPrefixListProperties(StringBuilder xamlStringBuilder) // Marker style xamlStringBuilder.Append(" MarkerStyle=\""); xamlStringBuilder.Append(Converters.MarkerStyleToString(FormatState.Marker)); - xamlStringBuilder.Append("\""); + xamlStringBuilder.Append('"'); // Note that we don't allow a value of zero here, since XAML doesn't support it. if (FormatState.StartIndex > 0 && FormatState.StartIndex != 1) { xamlStringBuilder.Append(" StartIndex=\""); xamlStringBuilder.Append(FormatState.StartIndex.ToString(CultureInfo.InvariantCulture)); - xamlStringBuilder.Append("\""); + xamlStringBuilder.Append('"'); } // Handle direction @@ -5313,7 +5313,7 @@ private void AppendXamlPrefixHyperlinkProperties(StringBuilder xamlStringBuilder { xamlStringBuilder.Append(" NavigateUri=\""); xamlStringBuilder.Append(Converters.StringToXMLAttribute(NavigateUri)); - xamlStringBuilder.Append("\""); + xamlStringBuilder.Append('"'); } } @@ -5396,7 +5396,7 @@ internal void AppendInlineXamlPrefix(ConverterState converterState) { xamlStringBuilder.Append(" Background=\""); xamlStringBuilder.Append(entry.Color.ToString()); - xamlStringBuilder.Append("\""); + xamlStringBuilder.Append('"'); } } @@ -5425,7 +5425,7 @@ internal void AppendInlineXamlPrefix(ConverterState converterState) xamlStringBuilder.Append(" Typography.Variants=\"Subscript\""); } - xamlStringBuilder.Append(">"); + xamlStringBuilder.Append('>'); Xaml = xamlStringBuilder.ToString(); } @@ -8429,7 +8429,7 @@ internal DocumentNode ProcessHyperlinkField(string instr) } if (sBookmark != null) { - sb.Append("#"); + sb.Append('#'); sb.Append(sBookmark); } @@ -8682,7 +8682,7 @@ internal void ProcessImage(FormatState formatState) width = formatState.ImageWidth; } imageStringBuilder.Append(width.ToString(CultureInfo.InvariantCulture)); - imageStringBuilder.Append("\""); + imageStringBuilder.Append('"'); // Add the xaml image height property imageStringBuilder.Append(" Height=\""); @@ -8696,7 +8696,7 @@ internal void ProcessImage(FormatState formatState) height = formatState.ImageHeight; } imageStringBuilder.Append(height.ToString(CultureInfo.InvariantCulture)); - imageStringBuilder.Append("\""); + imageStringBuilder.Append('"'); // Add the xaml image baseline offset property if (formatState.IncludeImageBaselineOffset == true) @@ -8704,16 +8704,16 @@ internal void ProcessImage(FormatState formatState) double baselineOffset = height - formatState.ImageBaselineOffset; imageStringBuilder.Append(" TextBlock.BaselineOffset=\""); imageStringBuilder.Append(baselineOffset.ToString(CultureInfo.InvariantCulture)); - imageStringBuilder.Append("\""); + imageStringBuilder.Append('"'); } // Add the xaml image stretch property imageStringBuilder.Append(" Stretch=\"Fill"); - imageStringBuilder.Append("\""); + imageStringBuilder.Append('"'); // Add the xaml image close tag - imageStringBuilder.Append(">"); + imageStringBuilder.Append('>'); // Add the image source property as the complex property // This is for specifying BitmapImage.CacheOption as OnLoad instead of diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/TextStore.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/TextStore.cs index ac7c8d4ab04..46ebc8eeed2 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/TextStore.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/TextStore.cs @@ -4855,7 +4855,7 @@ private static string DisplayType(object o) { if (needSeparator) { - sb.Append("/"); + sb.Append('/'); } string name = t.ToString(); @@ -5036,9 +5036,7 @@ private static TraceList AddToMap(FrameworkElement target) { int dotIndex = filename.LastIndexOf(".", StringComparison.Ordinal); if (dotIndex < 0) dotIndex = filename.Length; - filename = filename.Substring(0, dotIndex) + - s_seqno.ToString() + - filename.Substring(dotIndex); + filename = $"{filename.AsSpan(0, dotIndex)}{s_seqno}{filename.AsSpan(dotIndex)}"; } // create the TraceList 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 38f25f977fe..7d1bbaaa036 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 @@ -533,17 +533,17 @@ private void WriteFontTable() { FontTableEntry entry = fontTable.EntryAt(i); - _rtfBuilder.Append("{"); + _rtfBuilder.Append('{'); _rtfBuilder.Append("\\f"); _rtfBuilder.Append(entry.Index.ToString(CultureInfo.InvariantCulture)); _rtfBuilder.Append("\\fcharset"); _rtfBuilder.Append(entry.CharSet.ToString(CultureInfo.InvariantCulture)); - _rtfBuilder.Append(" "); + _rtfBuilder.Append(' '); XamlParserHelper.AppendRTFText(_rtfBuilder, entry.Name, entry.CodePage); _rtfBuilder.Append(";}"); } - _rtfBuilder.Append("}"); + _rtfBuilder.Append('}'); } private void WriteColorTable() @@ -563,10 +563,10 @@ private void WriteColorTable() _rtfBuilder.Append(color.G.ToString(CultureInfo.InvariantCulture)); _rtfBuilder.Append("\\blue"); _rtfBuilder.Append(color.B.ToString(CultureInfo.InvariantCulture)); - _rtfBuilder.Append(";"); + _rtfBuilder.Append(';'); } - _rtfBuilder.Append("}"); + _rtfBuilder.Append('}'); } private void WriteListTable() @@ -631,13 +631,13 @@ private void WriteListTable() _rtfBuilder.Append(indent); _rtfBuilder.Append("\\jclisttab\\tx"); _rtfBuilder.Append(indent); - _rtfBuilder.Append("}"); + _rtfBuilder.Append('}'); } _rtfBuilder.Append("\r\n{\\listname ;}"); _rtfBuilder.Append("\\listid"); _rtfBuilder.Append(listTableEntry.ID.ToString(CultureInfo.InvariantCulture)); - _rtfBuilder.Append("}"); + _rtfBuilder.Append('}'); } _rtfBuilder.Append("}\r\n"); @@ -664,7 +664,7 @@ private void WriteListTable() } _rtfBuilder.Append("\\ls"); _rtfBuilder.Append(lo.Index.ToString(CultureInfo.InvariantCulture)); - _rtfBuilder.Append("}"); + _rtfBuilder.Append('}'); } _rtfBuilder.Append("\r\n}\r\n"); @@ -717,7 +717,7 @@ private void WriteInlineChild(DocumentNode documentNode) // Start a context so any properties only apply here if (outAny) { - _rtfBuilder.Append("{"); + _rtfBuilder.Append('{'); } // Write properties @@ -828,7 +828,7 @@ private void WriteInlineChild(DocumentNode documentNode) // Ensure space delimiter after control word if (outAny) { - _rtfBuilder.Append(" "); + _rtfBuilder.Append(' '); } // Write contents here @@ -889,13 +889,13 @@ private void WriteInlineChild(DocumentNode documentNode) // End context if (outAny) { - _rtfBuilder.Append("}"); + _rtfBuilder.Append('}'); } } private void WriteUIContainerChild(DocumentNode documentNode) { - _rtfBuilder.Append("{"); + _rtfBuilder.Append('{'); DocumentNodeArray dna = _converterState.DocumentNodeArray; @@ -921,7 +921,7 @@ private void WriteUIContainerChild(DocumentNode documentNode) } // Close Section writing - _rtfBuilder.Append("}"); + _rtfBuilder.Append('}'); _rtfBuilder.Append("\r\n"); } @@ -935,7 +935,7 @@ private void WriteSection(DocumentNode dnThis) FormatState fsParent = dnThis.Parent != null ? dnThis.Parent.FormatState : FormatState.EmptyFormatState; DocumentNodeArray dna = _converterState.DocumentNodeArray; - _rtfBuilder.Append("{"); + _rtfBuilder.Append('{'); // CultureInfo if (fsThis.Lang != fsParent.Lang && fsThis.Lang > 0) @@ -953,7 +953,7 @@ private void WriteSection(DocumentNode dnThis) // Write the font information if (WriteParagraphFontInfo(dnThis, fsThis, fsParent)) { - _rtfBuilder.Append(" "); + _rtfBuilder.Append(' '); } // Foreground @@ -1018,7 +1018,7 @@ private void WriteSection(DocumentNode dnThis) } // Close Section writing - _rtfBuilder.Append("}"); + _rtfBuilder.Append('}'); _rtfBuilder.Append("\r\n"); } @@ -1032,7 +1032,7 @@ private void WriteParagraph(DocumentNode dnThis) FormatState fsParent = dnThis.Parent != null ? dnThis.Parent.FormatState : FormatState.EmptyFormatState; DocumentNodeArray dna = _converterState.DocumentNodeArray; - _rtfBuilder.Append("{"); + _rtfBuilder.Append('{'); bool bOutControl = WriteParagraphFontInfo(dnThis, fsThis, fsParent); @@ -1045,13 +1045,13 @@ private void WriteParagraph(DocumentNode dnThis) } if (bOutControl) { - _rtfBuilder.Append(" "); + _rtfBuilder.Append(' '); } bOutControl = WriteParagraphListInfo(dnThis, fsThis); if (bOutControl) { - _rtfBuilder.Append(" "); + _rtfBuilder.Append(' '); } // FlowDirection control - state it before writing nested inline node. @@ -1176,7 +1176,7 @@ private void WriteParagraph(DocumentNode dnThis) { _rtfBuilder.Append("\\par"); } - _rtfBuilder.Append("}"); + _rtfBuilder.Append('}'); _rtfBuilder.Append("\r\n"); } @@ -1301,7 +1301,7 @@ private bool WriteParagraphListInfo(DocumentNode dnThis, FormatState fsThis) if (dnList.FormatState.Marker != MarkerStyle.MarkerBullet && dnList.FormatState.Marker != MarkerStyle.MarkerNone) { - _rtfBuilder.Append("."); + _rtfBuilder.Append('.'); } _rtfBuilder.Append("\\tab}"); @@ -1326,7 +1326,7 @@ private bool WriteParagraphListInfo(DocumentNode dnThis, FormatState fsThis) if (dnList.FormatState.Marker != MarkerStyle.MarkerBullet && dnList.FormatState.Marker != MarkerStyle.MarkerNone) { - _rtfBuilder.Append("."); + _rtfBuilder.Append('.'); } _rtfBuilder.Append("\\tab}{\\*\\pn"); _rtfBuilder.Append(Converters.MarkerStyleToOldRTFString(dnList.FormatState.Marker)); @@ -1376,7 +1376,7 @@ private void WriteRow(DocumentNode dnRow) // [Repeat] \row // _rtfBuilder.Append("\r\n"); - _rtfBuilder.Append("{"); + _rtfBuilder.Append('{'); if (nDepth == 1) { WriteRowStart(dnRow); @@ -1396,7 +1396,7 @@ private void WriteRow(DocumentNode dnRow) _rtfBuilder.Append("\\intbl\\itap"); _rtfBuilder.Append(nDepth.ToString(CultureInfo.InvariantCulture)); } - _rtfBuilder.Append("{"); + _rtfBuilder.Append('{'); if (nDepth > 1) { _rtfBuilder.Append("\\*\\nesttableprops"); @@ -1521,14 +1521,14 @@ private void WriteRowsCellContents(DocumentNode dnRow) { DocumentNodeArray cellArray = dnRow.GetRowsCells(); - _rtfBuilder.Append("{"); + _rtfBuilder.Append('{'); for (int i = 0; i < cellArray.Count; i++) { DocumentNode dnCell = cellArray.EntryAt(i); WriteStructure(dnCell); } - _rtfBuilder.Append("}"); + _rtfBuilder.Append('}'); } private long WriteCellProperties(DocumentNode dnCell, int nCol, long lastCellX) @@ -1991,7 +1991,7 @@ private void WriteDocumentContents() private void WriteEpilog() { - _rtfBuilder.Append("}"); + _rtfBuilder.Append('}'); } private void WriteOutput() @@ -4033,7 +4033,7 @@ private static void AppendRtfUnicodeChar(StringBuilder sb, char c, int cp, ref E sb.Append("\\u"); short sc = (short)c; sb.Append(sc.ToString(CultureInfo.InvariantCulture)); - sb.Append("?"); + sb.Append('?'); } } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/XAMLParseException.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/XAMLParseException.cs index 5b92931a73f..cd3d941d5ed 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/XAMLParseException.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/XAMLParseException.cs @@ -427,7 +427,7 @@ Type objectType StringBuilder sb = new StringBuilder(message); if (innerException.Message != String.Empty) { - sb.Append(" "); + sb.Append(' '); } sb.Append(innerException.Message); diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/PropertyPath.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/PropertyPath.cs index 6f864c6bbca..36ae757c33c 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/PropertyPath.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/PropertyPath.cs @@ -281,7 +281,7 @@ internal int ComputeUnresolvedAttachedPropertiesInPath() { // a dot inside parens, when there's no early-bound accessor, // is an unresolved PD name - if (name.IndexOf('.') >= 0) + if (name.Contains('.')) ++ result; } } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/SystemResources.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/SystemResources.cs index 1bc74098942..0af317c99b2 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/SystemResources.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/SystemResources.cs @@ -779,7 +779,7 @@ private void LoadExternalAssembly(bool classic, bool generic, out Assembly assem StringBuilder sb = new StringBuilder(_assemblyName.Length + 10); sb.Append(_assemblyName); - sb.Append("."); + sb.Append('.'); if (generic) { diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/ThemeDictionaryExtension.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/ThemeDictionaryExtension.cs index 805939a1204..d353e55a211 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/ThemeDictionaryExtension.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/ThemeDictionaryExtension.cs @@ -110,7 +110,7 @@ private static Uri GenerateUri(string assemblyName, string resourceName, string { StringBuilder uri = new StringBuilder(assemblyName.Length + 50); - uri.Append("/"); + uri.Append('/'); uri.Append(assemblyName); // If assembly is PresentationFramework, append the Theme name diff --git a/src/Microsoft.DotNet.Wpf/src/ReachFramework/Serialization/VisualSerializer.cs b/src/Microsoft.DotNet.Wpf/src/ReachFramework/Serialization/VisualSerializer.cs index 0b466be09fd..6541ca105ca 100644 --- a/src/Microsoft.DotNet.Wpf/src/ReachFramework/Serialization/VisualSerializer.cs +++ b/src/Microsoft.DotNet.Wpf/src/ReachFramework/Serialization/VisualSerializer.cs @@ -987,11 +987,11 @@ private void AppendMatrix(StringBuilder rslt, Matrix mat) { if (!Utility.IsIdentity(mat)) { - rslt.Append(CheckFloat(mat.M11).ToString(CultureInfo.InvariantCulture)); rslt.Append(","); - rslt.Append(CheckFloat(mat.M12).ToString(CultureInfo.InvariantCulture)); rslt.Append(","); - rslt.Append(CheckFloat(mat.M21).ToString(CultureInfo.InvariantCulture)); rslt.Append(","); - rslt.Append(CheckFloat(mat.M22).ToString(CultureInfo.InvariantCulture)); rslt.Append(","); - rslt.Append(CheckFloat(mat.OffsetX).ToString(CultureInfo.InvariantCulture)); rslt.Append(","); + rslt.Append(CheckFloat(mat.M11).ToString(CultureInfo.InvariantCulture)); rslt.Append(','); + rslt.Append(CheckFloat(mat.M12).ToString(CultureInfo.InvariantCulture)); rslt.Append(','); + rslt.Append(CheckFloat(mat.M21).ToString(CultureInfo.InvariantCulture)); rslt.Append(','); + rslt.Append(CheckFloat(mat.M22).ToString(CultureInfo.InvariantCulture)); rslt.Append(','); + rslt.Append(CheckFloat(mat.OffsetX).ToString(CultureInfo.InvariantCulture)); rslt.Append(','); rslt.Append(CheckFloat(mat.OffsetY).ToString(CultureInfo.InvariantCulture)); } } diff --git a/src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/HashHelper.cs b/src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/HashHelper.cs index a9465236ce7..b61ed460255 100644 --- a/src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/HashHelper.cs +++ b/src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/HashHelper.cs @@ -32,9 +32,11 @@ static HashHelper() { Initialize(); // this makes FxCop happy - otherwise Initialize is "unused code" - Type[] types = new Type[] { #if WINDOWS_BASE -#elif PRESENTATION_CORE + Type[] types = Type.EmptyTypes; +#else + Type[] types = new Type[] { +#if PRESENTATION_CORE typeof(System.Windows.Media.CharacterMetrics), // bug 1612093 typeof(System.Windows.Ink.ExtendedProperty), // bug 1612101 typeof(System.Windows.Media.FamilyTypeface), // bug 1612103 @@ -44,7 +46,7 @@ static HashHelper() typeof(System.Windows.ComponentResourceKey), // bug 1612119 #endif }; - +#endif BaseHashHelper.RegisterTypes(typeof(HashHelper).Assembly, types); // initialize lower-level assemblies diff --git a/src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/SecurityHelper.cs b/src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/SecurityHelper.cs index d8484d07a8b..2f94ec635ae 100644 --- a/src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/SecurityHelper.cs +++ b/src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/SecurityHelper.cs @@ -228,7 +228,7 @@ System.Windows.MessageBoxImage image internal static bool AreStringTypesEqual(string m1, string m2) { - return (String.Compare(m1, m2, StringComparison.OrdinalIgnoreCase) == 0); + return (string.Equals(m1, m2, StringComparison.OrdinalIgnoreCase)); } #endif //PRESENTATION_CORE || PRESENTATIONFRAMEWORK || WINDOWS_BASE diff --git a/src/Microsoft.DotNet.Wpf/src/Shared/MS/Win32/HwndWrapper.cs b/src/Microsoft.DotNet.Wpf/src/Shared/MS/Win32/HwndWrapper.cs index ededd20817b..c6672b0fede 100644 --- a/src/Microsoft.DotNet.Wpf/src/Shared/MS/Win32/HwndWrapper.cs +++ b/src/Microsoft.DotNet.Wpf/src/Shared/MS/Win32/HwndWrapper.cs @@ -51,7 +51,7 @@ public HwndWrapper( IntPtr parent, HwndWrapperHook[] hooks) { - _ownerThreadID = new SecurityCriticalDataForSet(Thread.CurrentThread.ManagedThreadId); + _ownerThreadID = new SecurityCriticalDataForSet(Environment.CurrentManagedThreadId); // First, add the set of hooks. This allows the hooks to receive the @@ -214,7 +214,7 @@ private void Dispose(bool disposing, bool isHwndBeingDestroyed) // (we know this since we're listening for WM_NCDESTROY). Since we're being disposed // we destroy it now. - if(Thread.CurrentThread.ManagedThreadId == _ownerThreadID.Value) + if(Environment.CurrentManagedThreadId == _ownerThreadID.Value) { // We are the owner thread, we can safely destroy the window and unregister // the class diff --git a/src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Ink/KnownIds.cs b/src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Ink/KnownIds.cs index ace6cb79ff1..2681238acee 100644 --- a/src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Ink/KnownIds.cs +++ b/src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Ink/KnownIds.cs @@ -314,7 +314,7 @@ internal static string ConvertToString (Guid id) System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Default, - null, null, new object[]{}, + null, null, Array.Empty(), System.Globalization.CultureInfo.InvariantCulture) ) { return info.Name; diff --git a/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClientSideProviders/MS/Internal/AutomationProxies/Misc.cs b/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClientSideProviders/MS/Internal/AutomationProxies/Misc.cs index 04e6f75f11b..12860054cf5 100644 --- a/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClientSideProviders/MS/Internal/AutomationProxies/Misc.cs +++ b/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClientSideProviders/MS/Internal/AutomationProxies/Misc.cs @@ -1139,7 +1139,7 @@ internal static bool ProxyGetGUIThreadInfo(uint idThread, out NativeMethods.GUIT { sb.Append(" ("); sb.Append(sbFlag); - sb.Append(")"); + sb.Append(')'); } sb.AppendFormat("\n\r\thwndActive = 0x{0:x8}", gui.hwndActive.ToInt32()); sb.AppendFormat("\n\r\thwndFocus = 0x{0:x8}", gui.hwndFocus.ToInt32()); diff --git a/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClientSideProviders/MS/Internal/AutomationProxies/WindowsRichEdit.cs b/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClientSideProviders/MS/Internal/AutomationProxies/WindowsRichEdit.cs index b6439c11205..b020b93f2e0 100644 --- a/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClientSideProviders/MS/Internal/AutomationProxies/WindowsRichEdit.cs +++ b/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClientSideProviders/MS/Internal/AutomationProxies/WindowsRichEdit.cs @@ -548,7 +548,7 @@ private string GetValue() { // If there is some kind of error, just append a space to the text. In this way // we will be no worse of then before implementing the embedded object get text. - sbText.Append(" "); + sbText.Append(' '); } start = embeddedObjectOffset + 1; embeddedObjectOffset = text.IndexOf((char)0xFFFC, start); diff --git a/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClientSideProviders/MS/Internal/AutomationProxies/WordBreaker.cs b/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClientSideProviders/MS/Internal/AutomationProxies/WordBreaker.cs index 5bb8440ceac..2e688e0bfef 100644 --- a/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClientSideProviders/MS/Internal/AutomationProxies/WordBreaker.cs +++ b/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClientSideProviders/MS/Internal/AutomationProxies/WordBreaker.cs @@ -755,7 +755,7 @@ internal static string GenerateText(TextPosition begin, TextPosition end) case TextSymbolType.ElementEnd: if (IsBreakingSymbol(navigator, LogicalDirection.Forward)) { - output.Append(" "); + output.Append(' '); } break; } diff --git a/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/IO/Packaging/PackUriHelper.cs b/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/IO/Packaging/PackUriHelper.cs index 1dfbec06155..87a6bf733b2 100644 --- a/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/IO/Packaging/PackUriHelper.cs +++ b/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/IO/Packaging/PackUriHelper.cs @@ -213,7 +213,7 @@ private static ArgumentException GetExceptionIfAbsoluteUri(Uri uri) private static ArgumentException GetExceptionIfFragmentPresent(string partName) { - if (partName.Contains("#")) + if (partName.Contains('#')) return new ArgumentException(SR.PartUriCannotHaveAFragment); else return null; diff --git a/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/IO/Packaging/Compoundfile/versionPair.cs b/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/IO/Packaging/Compoundfile/versionPair.cs index a7ea1d42c69..4d71d8d4501 100644 --- a/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/IO/Packaging/Compoundfile/versionPair.cs +++ b/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/IO/Packaging/Compoundfile/versionPair.cs @@ -110,6 +110,7 @@ public Int16 Minor /// The string is of the form (major,minor). /// public override string ToString() => string.Create(null, stackalloc char[64], $"({_major},{_minor})"); + #endif #endregion diff --git a/src/Microsoft.DotNet.Wpf/src/WpfGfx/codegen/mcg/generators/ManagedStruct.cs b/src/Microsoft.DotNet.Wpf/src/WpfGfx/codegen/mcg/generators/ManagedStruct.cs index 404da12eec4..2008d436c85 100644 --- a/src/Microsoft.DotNet.Wpf/src/WpfGfx/codegen/mcg/generators/ManagedStruct.cs +++ b/src/Microsoft.DotNet.Wpf/src/WpfGfx/codegen/mcg/generators/ManagedStruct.cs @@ -372,7 +372,7 @@ internal[[modifiers]] string ConvertToString(string format, IFormatProvider prov if (i != _collection.Count-1) { - str.Append(" "); + str.Append(' '); } } diff --git a/src/Microsoft.DotNet.Wpf/src/WpfGfx/codegen/mcg/helpers/StructHelper.cs b/src/Microsoft.DotNet.Wpf/src/WpfGfx/codegen/mcg/helpers/StructHelper.cs index bca300e4ace..39e93b6169b 100644 --- a/src/Microsoft.DotNet.Wpf/src/WpfGfx/codegen/mcg/helpers/StructHelper.cs +++ b/src/Microsoft.DotNet.Wpf/src/WpfGfx/codegen/mcg/helpers/StructHelper.cs @@ -204,9 +204,9 @@ private static void WriteField(CodeSink cs, McgField field) { foreach (McgArrayDimension dim in array.Dimensions) { - sb.Append("["); + sb.Append('['); sb.Append(dim.Size); - sb.Append("]"); + sb.Append(']'); } } diff --git a/src/Microsoft.DotNet.Wpf/src/WpfGfx/codegen/mcg/main/cmdline/CommandLineArguments.cs b/src/Microsoft.DotNet.Wpf/src/WpfGfx/codegen/mcg/main/cmdline/CommandLineArguments.cs index 866ed10ae76..d5cebff97e6 100644 --- a/src/Microsoft.DotNet.Wpf/src/WpfGfx/codegen/mcg/main/cmdline/CommandLineArguments.cs +++ b/src/Microsoft.DotNet.Wpf/src/WpfGfx/codegen/mcg/main/cmdline/CommandLineArguments.cs @@ -389,7 +389,7 @@ public string Usage oldLength = builder.Length; builder.Append(" <"); builder.Append(this.defaultArgument.LongName); - builder.Append(">"); + builder.Append('>'); builder.Append(Utility.NewLine); } diff --git a/src/Microsoft.DotNet.Wpf/src/WpfGfx/tools/csp/CsPrimeParser.cs b/src/Microsoft.DotNet.Wpf/src/WpfGfx/tools/csp/CsPrimeParser.cs index 3f3925efba9..021a9659caa 100644 --- a/src/Microsoft.DotNet.Wpf/src/WpfGfx/tools/csp/CsPrimeParser.cs +++ b/src/Microsoft.DotNet.Wpf/src/WpfGfx/tools/csp/CsPrimeParser.cs @@ -427,7 +427,7 @@ private void ProcessEmbeddedCSharp(string text) _stringBuilder.Append(text); _stringBuilder.Append("),"); _stringBuilder.Append(_tagStart.Column - _inline.Column - 4); - _stringBuilder.Append(")"); + _stringBuilder.Append(')'); _inMiddleOfOutputLine = true; } diff --git a/src/Microsoft.DotNet.Wpf/test/Common/DRT/TestServices/DrtBaseInput.cs b/src/Microsoft.DotNet.Wpf/test/Common/DRT/TestServices/DrtBaseInput.cs index d66e392ed45..33f5fad0a1f 100644 --- a/src/Microsoft.DotNet.Wpf/test/Common/DRT/TestServices/DrtBaseInput.cs +++ b/src/Microsoft.DotNet.Wpf/test/Common/DRT/TestServices/DrtBaseInput.cs @@ -36,7 +36,7 @@ string Identify(UIElement target) { StringBuilder sb = new StringBuilder(); sb.Append(target.GetType().Name); - sb.Append("."); + sb.Append('.'); sb.Append(target.GetHashCode().ToString()); string name = null; @@ -48,9 +48,9 @@ string Identify(UIElement target) if (!String.IsNullOrEmpty(name)) { - sb.Append("\""); + sb.Append('"'); sb.Append(name); - sb.Append("\""); + sb.Append('"'); } return sb.ToString(); diff --git a/src/Microsoft.DotNet.Wpf/test/DRT/DrtXaml/XamlTestClasses/ObjectReaderClasses.cs b/src/Microsoft.DotNet.Wpf/test/DRT/DrtXaml/XamlTestClasses/ObjectReaderClasses.cs index e0727f512a5..4b6bb96dd2e 100644 Binary files a/src/Microsoft.DotNet.Wpf/test/DRT/DrtXaml/XamlTestClasses/ObjectReaderClasses.cs and b/src/Microsoft.DotNet.Wpf/test/DRT/DrtXaml/XamlTestClasses/ObjectReaderClasses.cs differ diff --git a/src/Microsoft.DotNet.Wpf/test/DRT/DrtXaml/XamlTestClasses/TypeConverters.cs b/src/Microsoft.DotNet.Wpf/test/DRT/DrtXaml/XamlTestClasses/TypeConverters.cs index 58d778968bd..44d7804d412 100644 --- a/src/Microsoft.DotNet.Wpf/test/DRT/DrtXaml/XamlTestClasses/TypeConverters.cs +++ b/src/Microsoft.DotNet.Wpf/test/DRT/DrtXaml/XamlTestClasses/TypeConverters.cs @@ -392,7 +392,7 @@ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo cul if (i != animals.Count - 1) { - text.Append("#"); + text.Append('#'); } } return text.ToString();