Mono Class Library: Mono.Unix.UnixMarshal Overview | Members

Mono.Unix.UnixMarshal.PtrToStringArray Method

Allocates a string array and unmarshals the unmanaged string array into a managed string array using the specified encoding.

public static string[] PtrToStringArray (int count, IntPtr stringArray, System.Text.Encoding encoding)

Parameters

count
A int containing the number of strings in stringArray.
stringArray
A IntPtr containing a byte** array.
encoding
A stem.Text.Encoding specifying the encoding of the unmanaged strings within stringArray.

Returns

A string array containing count strings from the unmanaged string array stringArray. If stringArray is IntPtr.Zero, a string array containing zero elements is returned.

Exceptions

TypeReason
ArgumentNullExceptionencoding is null.

Remarks

No validation is done to ensure that the pointers for embedded strings are valid. This could result in an access violation or corrupted strings if you're not careful. Embedded null pointers will become null strings within the returned array.

The difference between this method and UnixMarshal.PtrToStringArray(IntPtr, System.Text.Encoding) is that this method doesn't require a terminating null pointer.

Requirements

Namespace: Mono.Unix
Assembly: Mono.Posix (in Mono.Posix.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0