From 03dce0bb552f30123eeb7f480b92e9fd66f98967 Mon Sep 17 00:00:00 2001 From: Greg G <6A@users.noreply.github.com> Date: Thu, 10 Nov 2016 16:03:24 +0100 Subject: [PATCH] Update IntrospectionExtensions.cs (dotnet/coreclr#8029) 1. A few tweaks were made to follow the [Coding Style](https://github.com/dotnet/corefx/blob/master/Documentation/coding-guidelines/coding-style.md). 2. A `null` check was done after doing a simple cast (`(IReflectableType)type`), but `rcType` cannot be `null` (it could only be `null` if a [`as`](https://msdn.microsoft.com/en-us/library/cc488006.aspx) cast was done). Commit migrated from https://github.com/dotnet/coreclr/commit/55a89556b53feeb6fcaa15ae48305994e690f2e0 --- .../System/Reflection/IntrospectionExtensions.cs | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/coreclr/src/mscorlib/src/System/Reflection/IntrospectionExtensions.cs b/src/coreclr/src/mscorlib/src/System/Reflection/IntrospectionExtensions.cs index a7e4151..49819a9 100644 --- a/src/coreclr/src/mscorlib/src/System/Reflection/IntrospectionExtensions.cs +++ b/src/coreclr/src/mscorlib/src/System/Reflection/IntrospectionExtensions.cs @@ -8,28 +8,21 @@ ** ** ** -** Purpose: go from type to type info +** Purpose: Get the underlying TypeInfo from a Type ** ** =============================================================================*/ - namespace System.Reflection { - using System.Reflection; - public static class IntrospectionExtensions { - public static TypeInfo GetTypeInfo(this Type type){ - if(type == null){ + public static TypeInfo GetTypeInfo(this Type type) + { + if (type == null) throw new ArgumentNullException(nameof(type)); - } + var rcType=(IReflectableType)type; - if(rcType==null){ - return null; - }else{ - return rcType.GetTypeInfo(); - } - } + return rcType.GetTypeInfo(); + } } } - -- 2.7.4