diff --git a/glib/Variant.cs b/glib/Variant.cs index bde56b665..2bb35be91 100644 --- a/glib/Variant.cs +++ b/glib/Variant.cs @@ -60,6 +60,18 @@ namespace GLib { this.handle = g_variant_ref_sink (handle); } + [DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)] + static extern IntPtr g_variant_get_type (IntPtr val); + + VariantType type; + public VariantType Type { + get { + if (type == null) + type = new VariantType (g_variant_get_type (Handle)); + return type; + } + } + [DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)] static extern IntPtr g_variant_new_variant (IntPtr val); diff --git a/sample/VariantDemo.cs b/sample/VariantDemo.cs index f13b74b71..5d2f1481e 100644 --- a/sample/VariantDemo.cs +++ b/sample/VariantDemo.cs @@ -33,6 +33,8 @@ namespace sample var asv = variant.ToAsv (); Console.WriteLine ("strv: " + asv["strv"].Print(true)); Console.WriteLine ("unit: " + asv["unit"].Print(true)); + + Console.WriteLine ("type: " + variant.Type.ToString ()); } public static void Main (string[] args) @@ -40,4 +42,4 @@ namespace sample new VariantDemo (); } } -} \ No newline at end of file +}