From f714425619d0ba850ceb2c1e52bb9ebf872ac759 Mon Sep 17 00:00:00 2001 From: dougbu Date: Mon, 17 Mar 2014 22:52:39 -0700 Subject: [PATCH] Revert "Address CR comments" This reverts commit d815329f71475367794a6ae495e8d598a0249260. --- src/Common/TypeExtensions.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Common/TypeExtensions.cs b/src/Common/TypeExtensions.cs index 45094fffce..027b4a75b4 100644 --- a/src/Common/TypeExtensions.cs +++ b/src/Common/TypeExtensions.cs @@ -52,7 +52,9 @@ namespace Microsoft.AspNet.Mvc { return type.GetTypeInfo().ImplementedInterfaces.ToArray(); } +#endif +#if NETFX_CORE || K10 public static bool IsAssignableFrom([NotNull] this Type type, [NotNull] Type c) { return type.GetTypeInfo().IsAssignableFrom(c.GetTypeInfo()); @@ -61,17 +63,29 @@ namespace Microsoft.AspNet.Mvc public static bool IsGenericType([NotNull] this Type type) { +#if NETFX_CORE || K10 return type.GetTypeInfo().IsGenericType; +#else + return type.IsGenericType; +#endif } public static bool IsInterface([NotNull] this Type type) { +#if NETFX_CORE || K10 return type.GetTypeInfo().IsInterface; +#else + return type.IsInterface; +#endif } public static bool IsValueType([NotNull] this Type type) { +#if NETFX_CORE || K10 return type.GetTypeInfo().IsValueType; +#else + return type.IsValueType; +#endif } public static bool IsCompatibleWith([NotNull] this Type type, object value) @@ -92,6 +106,8 @@ namespace Microsoft.AspNet.Mvc public static bool HasStringConverter([NotNull] this Type type) { + // TODO: This depends on TypeConverter which does not exist in the CoreCLR. + // return TypeDescriptor.GetConverter(type).CanConvertFrom(typeof(string)); TypeInfo typeInfo = type.GetTypeInfo(); if (typeInfo.IsPrimitive || type == typeof(string)) { @@ -102,7 +118,6 @@ namespace Microsoft.AspNet.Mvc // Nullable where T is a primitive type or has a type converter return true; } - return false; }