From 59745830d56db077e7d3d982d33a0f1a74df5b39 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Wed, 6 May 2020 11:23:17 -0700 Subject: [PATCH] Specially-handle TimeSpan as a primitive type. (#261) --- WinRT.Runtime/TypeNameSupport.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/WinRT.Runtime/TypeNameSupport.cs b/WinRT.Runtime/TypeNameSupport.cs index c1b11de88..c6025c981 100644 --- a/WinRT.Runtime/TypeNameSupport.cs +++ b/WinRT.Runtime/TypeNameSupport.cs @@ -110,6 +110,7 @@ public static Type ResolvePrimitiveType(string primitiveTypeName) "Double" => typeof(double), "Guid" => typeof(Guid), "Object" => typeof(object), + "TimeSpan" => typeof(TimeSpan), _ => null }; } @@ -199,7 +200,7 @@ public static string GetNameForType(Type type, TypeNameGenerationFlags flags) private static bool TryAppendSimpleTypeName(Type type, StringBuilder builder, TypeNameGenerationFlags flags) { - if (type.IsPrimitive || type == typeof(string) || type == typeof(Guid)) + if (type.IsPrimitive || type == typeof(string) || type == typeof(Guid) || type == typeof(TimeSpan)) { if ((flags & TypeNameGenerationFlags.GenerateBoxedName) != 0) {