From eac980a3c22ddd58393d633858f0ceba16261348 Mon Sep 17 00:00:00 2001 From: Michael Winsor Date: Thu, 16 Feb 2017 23:52:30 -0700 Subject: [PATCH] Updated variant.cs for issue #787 Added setter functionality to assign byte and sbyte values to a variant type. This will correct the issue described in issue #767 --- Source/SharpDX/Win32/Variant.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Source/SharpDX/Win32/Variant.cs b/Source/SharpDX/Win32/Variant.cs index 409479e05..529b233e5 100644 --- a/Source/SharpDX/Win32/Variant.cs +++ b/Source/SharpDX/Win32/Variant.cs @@ -275,6 +275,20 @@ public unsafe object Value Type = VariantType.Default; if (type.GetTypeInfo().IsPrimitive) { + if (type == typeof(byte)) + { + ElementType = VariantElementType.UByte; + variantValue.byteValue = (byte)value; + return; + } + + if (type == typeof(sbyte)) + { + ElementType = VariantElementType.Byte; + variantValue.signedByteValue = (sbyte)value; + return; + } + if (type == typeof(int)) { ElementType = VariantElementType.Int;