Fix IDE0029 (use coalesce expression)
authorStephen Toub <stoub@microsoft.com>
Fri, 16 Aug 2019 13:06:04 +0000 (09:06 -0400)
committerStephen Toub <stoub@microsoft.com>
Sat, 17 Aug 2019 11:31:50 +0000 (07:31 -0400)
Commit migrated from https://github.com/dotnet/coreclr/commit/3e61222f2c42637a1b88d69c19e28e9cff60b238

src/coreclr/src/System.Private.CoreLib/src/System/Reflection/MdConstant.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeParameterInfo.cs
src/libraries/System.Private.CoreLib/src/System/Resources/ResourceManager.cs

index 144aa32..db373cb 100644 (file)
@@ -126,7 +126,7 @@ namespace System.Reflection
                     CorElementType.ELEMENT_TYPE_BOOLEAN => (*(int*)&buffer != 0),
                     CorElementType.ELEMENT_TYPE_R4 => *(float*)&buffer,
                     CorElementType.ELEMENT_TYPE_R8 => *(double*)&buffer,
-                    CorElementType.ELEMENT_TYPE_STRING => stringVal == null ? string.Empty : stringVal,
+                    CorElementType.ELEMENT_TYPE_STRING => stringVal ?? string.Empty,
                     CorElementType.ELEMENT_TYPE_CLASS => null,
                     _ => throw new FormatException(SR.Arg_BadLiteralFormat),
                 };
index b03b0a6..f375e17 100644 (file)
@@ -131,7 +131,7 @@ namespace System.Reflection
         {
             get
             {
-                MethodBase? result = m_originalMember != null ? m_originalMember : MemberImpl as MethodBase;
+                MethodBase? result = m_originalMember ?? MemberImpl as MethodBase;
                 Debug.Assert(result != null);
                 return result;
             }
index 3a2ea1a..ae54ed2 100644 (file)
@@ -274,7 +274,7 @@ namespace System.Resources
         // to construct ResourceSets.
         public virtual Type ResourceSetType
         {
-            get { return (_userResourceSet == null) ? typeof(RuntimeResourceSet) : _userResourceSet; }
+            get { return _userResourceSet ?? typeof(RuntimeResourceSet); }
         }
 
         protected UltimateResourceFallbackLocation FallbackLocation