Table of Contents

Class NativeTypeConversion

Namespace
CarinaStudio.MacOS
Assembly
CarinaStudio.AppBase.MacOS.dll

Conversion between native and CLR types. The class is not supposed to be used directly. It is used for internal type conversion and code generation.

public static class NativeTypeConversion
Inheritance
NativeTypeConversion
Inherited Members

Methods

FromNativeParameter(object, Type)

Convert from native parameter to CLR parameter.

public static object? FromNativeParameter(object nativeValue, Type targetType)

Parameters

nativeValue object
targetType Type

Returns

object

FromNativeValue(byte*, int, Type, out int)

Convert from native value to CLR value.

public static object? FromNativeValue(byte* valuePtr, int valueCount, Type targetType, out int consumedBytes)

Parameters

valuePtr byte*
valueCount int
targetType Type
consumedBytes int

Returns

object

FromTypeEncoding(string, out int)

Convert from Objective-C type encoding.

public static Type FromTypeEncoding(string typeEncoding, out int elementCount)

Parameters

typeEncoding string
elementCount int

Returns

Type

GetNativeValueSize(Type)

Get size of native value in bytes.

public static int GetNativeValueSize(Type type)

Parameters

type Type

Returns

int

IsNativeType(Type)

Check whether given type is the native type or not.

public static bool IsNativeType(Type type)

Parameters

type Type

Returns

bool

ToNativeParameter(object?)

Convert from CLR parameter to native parameter.

public static object ToNativeParameter(object? value)

Parameters

value object

Returns

object

ToNativeType(Type)

Convert to corresponding native type.

public static Type ToNativeType(Type type)

Parameters

type Type

Returns

Type

ToNativeValue(object?, byte*)

Convert from CLR object to native value.

public static int ToNativeValue(object? obj, byte* valuePtr)

Parameters

obj object
valuePtr byte*

Returns

int

ToTypeEncoding(object)

Convert to Objective-C type encoding.

public static string ToTypeEncoding(object obj)

Parameters

obj object

Returns

string

ToTypeEncoding(Type, int)

Convert to Objective-C type encoding.

public static string ToTypeEncoding(Type type, int elementCount = 1)

Parameters

type Type
elementCount int

Returns

string

ToTypeEncoding<T>(int)

Convert to Objective-C type encoding.

public static string ToTypeEncoding<T>(int elementCount = 1)

Parameters

elementCount int

Returns

string

Type Parameters

T