mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2025-01-09 18:55:42 +00:00
39 lines
1 KiB
C#
39 lines
1 KiB
C#
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using GLib;
|
||
|
|
||
|
namespace sample
|
||
|
{
|
||
|
public class VariantDemo
|
||
|
{
|
||
|
public VariantDemo ()
|
||
|
{
|
||
|
var strv = new string[] {"String 1", "String 2"};
|
||
|
var variant = new Variant (strv);
|
||
|
Console.WriteLine (variant.Print (true));
|
||
|
|
||
|
variant = Variant.NewTuple (new Variant[] {variant, new Variant ("String 3")});
|
||
|
Console.WriteLine (variant.Print (true));
|
||
|
|
||
|
variant = Variant.NewTuple (null);
|
||
|
Console.WriteLine (variant.Print (true));
|
||
|
|
||
|
variant = Variant.NewArray (null, new Variant[] {new Variant ("String 4"), new Variant ("String 5")});
|
||
|
Console.WriteLine (variant.Print (true));
|
||
|
|
||
|
variant = Variant.NewArray (VariantType.String, null);
|
||
|
Console.WriteLine (variant.Print (true));
|
||
|
|
||
|
var dict = new Dictionary<string, Variant> ();
|
||
|
dict.Add ("strv", new Variant (strv));
|
||
|
dict.Add ("unit", Variant.NewTuple (null));
|
||
|
variant = new Variant (dict);
|
||
|
Console.WriteLine (variant.Print (true));
|
||
|
}
|
||
|
|
||
|
public static void Main (string[] args)
|
||
|
{
|
||
|
new VariantDemo ();
|
||
|
}
|
||
|
}
|
||
|
}
|