Lib

cs.Lib (Class)

Platform-specific C# Library. Provides some platform-specific functions for the C# target, such as conversion from haxe types to native types and vice-versa.

Static Members

applyCultureChanges(): Void

Changes the current culture settings to allow a consistent cross-target behavior. Currently the only change made is in regard to the decimal separator, which is always set to "."


nativeArray(arr: Array<nativeArray.T>, equalLengthRequired: Bool): NativeArray<nativeArray.T>

Returns a native array from the supplied Array. This native array is unsafe to be written on, as it may or may not be linked to the actual Array implementation.

If equalLengthRequired is true, the result might be a copy of an array with the correct size.

Name Type
arr Array<nativeArray.T>
equalLengthRequired Bool
Returns
NativeArray<nativeArray.T>

as(obj: Dynamic, cl: Class<as.T>): as.T

Provides support for the "as" keyword in C#. If the object is not of the supplied type "T", it will return null instead of rasing an exception.

This function will not work with Value Types (such as Int, Float, Bool...)

Name Type
obj Dynamic
cl Class<as.T>
Returns
as.T

fromNativeType(t: cs.system.Type): Class<Dynamic>

Returns a Class<> equivalent to the native System.Type type.

Currently Haxe's Class<> is equivalent to System.Type, but this is an implementation detail. This may change in the future, so use this function whenever you need to perform such conversion.

Name Type
t cs.system.Type
Returns
Class<Dynamic>

toNativeType(cl: Class<Dynamic>): cs.system.Type

Returns a System.Type equivalent to the Haxe Class<> type.

Currently Haxe's Class<> is equivalent to System.Type, but this is an implementation detail. This may change in the future, so use this function whenever you need to perform such conversion.

Name Type
cl Class<Dynamic>
Returns
cs.system.Type

getNativeType(obj: Dynamic): cs.system.Type

Gets the native System.Type from the supplied object. Will throw an exception in case of null being passed.

Name Type
obj Dynamic
Returns
cs.system.Type

array(native: NativeArray<array.T>): Array<array.T>

Returns a Haxe Array of a native Array. Unless erase_generics is defined, it won't copy the contents of the native array, so unless any operation triggers an array resize, all changes made to the Haxe array will affect the native array argument.

Name Type
native NativeArray<array.T>
Returns
Array<array.T>

rethrow(e: Dynamic): Void

Rethrow an exception. This is useful when manually filtering an exception in order to keep the previous exception stack.

Name Type
e Dynamic

checked(block: checked.V): Void

Creates a "checked" block, which throws exceptions for overflows.

Usage: cs.Lib.checked({ var x = 1000; while(true) { x *= x; } }); This method only exists at compile-time, so it can't be called via reflection.

Name Type
block checked.V

lock(obj: lock.O, block: lock.V): Void

Ensures that one thread does not enter a critical section of code while another thread is in the critical section. If another thread attempts to enter a locked code, it will wait, block, until the object is released.

This method only exists at compile-time, so it can't be called via reflection.

Name Type
obj lock.O
block lock.V

Private Members

decimalSeparator: String

p_nativeArray(arr: Array<p_nativeArray.T>, ret: cs.system.Array): Void
Name Type
arr Array<p_nativeArray.T>
ret cs.system.Array

Metadata

Name Parameters
:hxGen -