Table of Contents

Class Variant

Namespace
GLib
Assembly
GLib-2.0.dll
public sealed class Variant : IDisposable
Inheritance
Variant
Implements
Inherited Members

Constructors

Variant(VariantOwnedHandle)

public Variant(VariantOwnedHandle handle)

Parameters

handle VariantOwnedHandle

Properties

Handle

public VariantOwnedHandle Handle { get; }

Property Value

VariantOwnedHandle

Methods

Byteswap()

[Version("2.24")]
public Variant Byteswap()

Returns

Variant

CheckFormatString(string, bool)

[Version("2.34")]
public bool CheckFormatString(string formatString, bool copyOnly)

Parameters

formatString string
copyOnly bool

Returns

bool

Classify()

[Version("2.24")]
public VariantClass Classify()

Returns

VariantClass

Compare(Variant)

[Version("2.26")]
public int Compare(Variant two)

Parameters

two Variant

Returns

int

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

DupBytestringArray(out nuint)

[Version("2.26")]
public string[] DupBytestringArray(out nuint length)

Parameters

length nuint

Returns

string[]

DupObjv(out nuint)

[Version("2.30")]
public string[] DupObjv(out nuint length)

Parameters

length nuint

Returns

string[]

DupString(out nuint)

[Version("2.24")]
public string DupString(out nuint length)

Parameters

length nuint

Returns

string

DupStrv(out nuint)

[Version("2.24")]
public string[] DupStrv(out nuint length)

Parameters

length nuint

Returns

string[]

Equal(Variant)

[Version("2.24")]
public bool Equal(Variant two)

Parameters

two Variant

Returns

bool

Equals(Variant?)

public bool Equals(Variant? other)

Parameters

other Variant

Returns

bool

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

GetBoolean()

[Version("2.24")]
public bool GetBoolean()

Returns

bool

GetByte()

[Version("2.24")]
public byte GetByte()

Returns

byte

GetBytestringArray(out nuint)

[Version("2.26")]
public string[] GetBytestringArray(out nuint length)

Parameters

length nuint

Returns

string[]

GetChildValue(nuint)

[Version("2.24")]
public Variant GetChildValue(nuint index)

Parameters

index nuint

Returns

Variant

GetData()

[Version("2.24")]
public IntPtr GetData()

Returns

IntPtr

GetDataAsBytes()

[Version("2.36")]
public Bytes GetDataAsBytes()

Returns

Bytes

GetDouble()

[Version("2.24")]
public double GetDouble()

Returns

double

GetHandle()

[Version("2.24")]
public int GetHandle()

Returns

int

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

GetInt16()

[Version("2.24")]
public short GetInt16()

Returns

short

GetInt32()

[Version("2.24")]
public int GetInt32()

Returns

int

GetInt64()

[Version("2.24")]
public long GetInt64()

Returns

long

GetMaybe()

[Version("2.24")]
public Variant? GetMaybe()

Returns

Variant

GetNormalForm()

[Version("2.24")]
public Variant GetNormalForm()

Returns

Variant

GetObjv(out nuint)

[Version("2.30")]
public string[] GetObjv(out nuint length)

Parameters

length nuint

Returns

string[]

GetSize()

[Version("2.24")]
public nuint GetSize()

Returns

nuint

GetString(out nuint)

[Version("2.24")]
public string GetString(out nuint length)

Parameters

length nuint

Returns

string

GetStrv(out nuint)

[Version("2.24")]
public string[] GetStrv(out nuint length)

Parameters

length nuint

Returns

string[]

GetType()

[Version("2.24")]
public VariantType GetType()

Returns

VariantType

GetTypeString()

[Version("2.24")]
public string GetTypeString()

Returns

string

GetUint16()

[Version("2.24")]
public ushort GetUint16()

Returns

ushort

GetUint32()

[Version("2.24")]
public uint GetUint32()

Returns

uint

GetUint64()

[Version("2.24")]
public ulong GetUint64()

Returns

ulong

GetVa(string, string?, IntPtr)

[Version("2.24")]
public void GetVa(string formatString, string? endptr, IntPtr app)

Parameters

formatString string
endptr string
app IntPtr

GetVariant()

[Version("2.24")]
public Variant GetVariant()

Returns

Variant

Hash()

[Version("2.24")]
public uint Hash()

Returns

uint

IsContainer()

[Version("2.24")]
public bool IsContainer()

Returns

bool

IsFloating()

[Version("2.26")]
public bool IsFloating()

Returns

bool

IsNormalForm()

[Version("2.24")]
public bool IsNormalForm()

Returns

bool

IsObjectPath(string)

[Version("2.24")]
public static bool IsObjectPath(string @string)

Parameters

string string

Returns

bool

IsOfType(VariantType)

[Version("2.24")]
public bool IsOfType(VariantType type)

Parameters

type VariantType

Returns

bool

IsSignature(string)

[Version("2.24")]
public static bool IsSignature(string @string)

Parameters

string string

Returns

bool

IterNew()

[Version("2.24")]
public VariantIter IterNew()

Returns

VariantIter

LookupValue(string, VariantType?)

[Version("2.28")]
public Variant LookupValue(string key, VariantType? expectedType)

Parameters

key string
expectedType VariantType

Returns

Variant

NChildren()

[Version("2.24")]
public nuint NChildren()

Returns

nuint

NewArray(VariantType?, Variant[]?)

[Version("2.24")]
public static Variant NewArray(VariantType? childType, Variant[]? children)

Parameters

childType VariantType
children Variant[]

Returns

Variant

NewBoolean(bool)

[Version("2.24")]
public static Variant NewBoolean(bool value)

Parameters

value bool

Returns

Variant

NewByte(byte)

[Version("2.24")]
public static Variant NewByte(byte value)

Parameters

value byte

Returns

Variant

NewBytestringArray(string[], long)

[Version("2.26")]
public static Variant NewBytestringArray(string[] strv, long length)

Parameters

strv string[]
length long

Returns

Variant

NewDictEntry(Variant, Variant)

[Version("2.24")]
public static Variant NewDictEntry(Variant key, Variant value)

Parameters

key Variant
value Variant

Returns

Variant

NewDouble(double)

[Version("2.24")]
public static Variant NewDouble(double value)

Parameters

value double

Returns

Variant

NewFixedArray(VariantType, IntPtr, nuint, nuint)

[Version("2.32")]
public static Variant NewFixedArray(VariantType elementType, IntPtr elements, nuint nElements, nuint elementSize)

Parameters

elementType VariantType
elements IntPtr
nElements nuint
elementSize nuint

Returns

Variant

NewFromBytes(VariantType, Bytes, bool)

[Version("2.36")]
public static Variant NewFromBytes(VariantType type, Bytes bytes, bool trusted)

Parameters

type VariantType
bytes Bytes
trusted bool

Returns

Variant

NewHandle(int)

[Version("2.24")]
public static Variant NewHandle(int value)

Parameters

value int

Returns

Variant

NewInt16(short)

[Version("2.24")]
public static Variant NewInt16(short value)

Parameters

value short

Returns

Variant

NewInt32(int)

[Version("2.24")]
public static Variant NewInt32(int value)

Parameters

value int

Returns

Variant

NewInt64(long)

[Version("2.24")]
public static Variant NewInt64(long value)

Parameters

value long

Returns

Variant

NewMaybe(VariantType?, Variant?)

[Version("2.24")]
public static Variant NewMaybe(VariantType? childType, Variant? child)

Parameters

childType VariantType
child Variant

Returns

Variant

NewObjectPath(string)

[Version("2.24")]
public static Variant NewObjectPath(string objectPath)

Parameters

objectPath string

Returns

Variant

NewObjv(string[], long)

[Version("2.30")]
public static Variant NewObjv(string[] strv, long length)

Parameters

strv string[]
length long

Returns

Variant

NewParsedVa(string, IntPtr)

public static Variant NewParsedVa(string format, IntPtr app)

Parameters

format string
app IntPtr

Returns

Variant

NewSignature(string)

[Version("2.24")]
public static Variant NewSignature(string signature)

Parameters

signature string

Returns

Variant

NewString(string)

[Version("2.24")]
public static Variant NewString(string @string)

Parameters

string string

Returns

Variant

NewStrv(string[], long)

[Version("2.24")]
public static Variant NewStrv(string[] strv, long length)

Parameters

strv string[]
length long

Returns

Variant

NewTakeString(string)

[Version("2.38")]
public static Variant NewTakeString(string @string)

Parameters

string string

Returns

Variant

NewTuple(Variant[])

[Version("2.24")]
public static Variant NewTuple(Variant[] children)

Parameters

children Variant[]

Returns

Variant

NewUint16(ushort)

[Version("2.24")]
public static Variant NewUint16(ushort value)

Parameters

value ushort

Returns

Variant

NewUint32(uint)

[Version("2.24")]
public static Variant NewUint32(uint value)

Parameters

value uint

Returns

Variant

NewUint64(ulong)

[Version("2.24")]
public static Variant NewUint64(ulong value)

Parameters

value ulong

Returns

Variant

NewVa(string, string?, IntPtr)

[Version("2.24")]
public static Variant NewVa(string formatString, string? endptr, IntPtr app)

Parameters

formatString string
endptr string
app IntPtr

Returns

Variant

NewVariant(Variant)

[Version("2.24")]
public static Variant NewVariant(Variant value)

Parameters

value Variant

Returns

Variant

Parse(VariantType?, string, string?, string?)

public static Variant Parse(VariantType? type, string text, string? limit, string? endptr)

Parameters

type VariantType
text string
limit string
endptr string

Returns

Variant

ParseErrorPrintContext(Error, string)

[Version("2.40")]
public static string ParseErrorPrintContext(Error error, string sourceStr)

Parameters

error Error
sourceStr string

Returns

string

ParseErrorQuark()

public static Quark ParseErrorQuark()

Returns

Quark

ParserGetErrorQuark()

public static Quark ParserGetErrorQuark()

Returns

Quark

Print(bool)

[Version("2.24")]
public string Print(bool typeAnnotate)

Parameters

typeAnnotate bool

Returns

string

PrintString(String?, bool)

[Version("2.24")]
public String PrintString(String? @string, bool typeAnnotate)

Parameters

string String
typeAnnotate bool

Returns

String

Ref()

[Version("2.24")]
public Variant Ref()

Returns

Variant

RefSink()

[Version("2.24")]
public Variant RefSink()

Returns

Variant

Store(IntPtr)

[Version("2.24")]
public void Store(IntPtr data)

Parameters

data IntPtr

TakeRef()

public Variant TakeRef()

Returns

Variant

Unref()

[Version("2.24")]
public void Unref()