Support object target type in .NET

Allow the `object` target type to be used by resources when they need to handle values that could be of a variety of different underlying types.
This commit is contained in:
Luke Hoban 2019-11-20 16:27:44 -08:00
parent 7278a7429c
commit 8d901c16b6

View file

@ -51,6 +51,9 @@ namespace Pulumi.Serialization
if (targetIsNullable)
return ConvertObject(context, val, targetType.GenericTypeArguments.Single());
if (targetType == typeof(object))
return EnsureType<object>(context, val);
if (targetType == typeof(string))
return EnsureType<string>(context, val);
@ -182,7 +185,8 @@ namespace Pulumi.Serialization
public static void CheckTargetType(string context, System.Type targetType)
{
if (targetType == typeof(bool) ||
if (targetType == typeof(object) ||
targetType == typeof(bool) ||
targetType == typeof(int) ||
targetType == typeof(double) ||
targetType == typeof(string) ||