Skip to content

Commit

Permalink
Specially-handle TimeSpan as a primitive type. (#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkoritzinsky authored May 6, 2020
1 parent 9949ced commit 5974583
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion WinRT.Runtime/TypeNameSupport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public static Type ResolvePrimitiveType(string primitiveTypeName)
"Double" => typeof(double),
"Guid" => typeof(Guid),
"Object" => typeof(object),
"TimeSpan" => typeof(TimeSpan),
_ => null
};
}
Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit 5974583

Please sign in to comment.