From cfe173ac0e90d1bc189c469464fd589f3f16ac3b Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Tue, 22 Aug 2017 17:44:48 -0700 Subject: [PATCH] Replace extension method 'IsComObject(this Type)' with Type.IsCOMObject (#4646) --- src/System.Management.Automation/engine/CoreAdapter.cs | 4 ++-- src/System.Management.Automation/engine/MshObject.cs | 2 +- .../utils/ExtensionMethods.cs | 10 ---------- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/System.Management.Automation/engine/CoreAdapter.cs b/src/System.Management.Automation/engine/CoreAdapter.cs index 4fbf9d629e..8761a6ff9d 100644 --- a/src/System.Management.Automation/engine/CoreAdapter.cs +++ b/src/System.Management.Automation/engine/CoreAdapter.cs @@ -2472,8 +2472,8 @@ namespace System.Management.Automation if (declaringTypeInfo.IsValueType || propertyTypeInfo.IsGenericType || declaringTypeInfo.IsGenericType || - property.DeclaringType.IsComObject() || - property.PropertyType.IsComObject()) + property.DeclaringType.IsCOMObject || + property.PropertyType.IsCOMObject) { this.readOnly = property.GetSetMethod() == null; this.writeOnly = property.GetGetMethod() == null; diff --git a/src/System.Management.Automation/engine/MshObject.cs b/src/System.Management.Automation/engine/MshObject.cs index 6dd16ab05b..822a26aaa8 100644 --- a/src/System.Management.Automation/engine/MshObject.cs +++ b/src/System.Management.Automation/engine/MshObject.cs @@ -463,7 +463,7 @@ namespace System.Management.Automation if (result == null) { - if (objectType.IsComObject()) + if (objectType.IsCOMObject) { // All WinRT types are COM types. // All WinRT types would contain the TypeAttributes flag being set to WindowsRunTime. diff --git a/src/System.Management.Automation/utils/ExtensionMethods.cs b/src/System.Management.Automation/utils/ExtensionMethods.cs index 2054f51b59..2ed4010572 100644 --- a/src/System.Management.Automation/utils/ExtensionMethods.cs +++ b/src/System.Management.Automation/utils/ExtensionMethods.cs @@ -118,16 +118,6 @@ namespace System.Management.Automation return LanguagePrimitives.IsInteger(LanguagePrimitives.GetTypeCode(type)); } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static bool IsComObject(this Type type) - { -#if UNIX - return false; -#else - return type.IsCOMObject; -#endif - } - [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static TypeCode GetTypeCode(this Type type) {