NSString.CreateNative Méthode

Définition

Surcharges

CreateNative(String, Int32, Int32, Boolean)
CreateNative(String, Int32, Int32)
CreateNative(String)

Crée un NSString Objective-C à partir de la chaîne C# et retourne un pointeur vers celle-ci.

CreateNative(String, Boolean)

CreateNative(String, Int32, Int32, Boolean)

public static IntPtr CreateNative (string value, int start, int length, bool autorelease);
static member CreateNative : string * int * int * bool -> nativeint

Paramètres

value
String
start
Int32
length
Int32
autorelease
Boolean

Retours

IntPtr

nativeint

S’applique à

CreateNative(String, Int32, Int32)

public static IntPtr CreateNative (string value, int start, int length);
static member CreateNative : string * int * int -> nativeint

Paramètres

value
String
start
Int32
length
Int32

Retours

IntPtr

nativeint

S’applique à

CreateNative(String)

Crée un NSString Objective-C à partir de la chaîne C# et retourne un pointeur vers celle-ci.

public static IntPtr CreateNative (string str);
static member CreateNative : string -> nativeint

Paramètres

str
String

Chaîne C# à encapsuler

Retours

IntPtr

nativeint

Le pointeur vers l’objet NSString doit être libéré avec ReleaseNative.

Remarques

Cette méthode crée un NSString Objective-C et retourne un IntPtr qui pointe vers celui-ci. Cela ne crée pas l’objet NSString managé qui pointe vers lui, ce qui est idéal pour les chaînes temporaires qui doivent être transmises à Objectiv-C, car il n’est pas nécessaire pour le garbage collector de Mono ou les moteurs monoTouch/Xamarin.Mac Framework de suivre cet objet.

La mémoire associée à cet objet doit être libérée en appelant la ReleaseNative(IntPtr) méthode .

IntPtr objcString = NSString.CreateNative ("Hello");
// You can pass objcString to any methods that expect an Objective-C NSString pointer
NSString.ReleaseNative (objcString);

S’applique à

CreateNative(String, Boolean)

public static IntPtr CreateNative (string str, bool autorelease);
static member CreateNative : string * bool -> nativeint

Paramètres

str
String
autorelease
Boolean

Retours

IntPtr

nativeint

S’applique à