Marshal.StringToCoTaskMemAuto(String) 메서드
정의
public:
static IntPtr StringToCoTaskMemAuto(System::String ^ s);
public static IntPtr StringToCoTaskMemAuto (string? s);
public static IntPtr StringToCoTaskMemAuto (string s);
[System.Security.SecurityCritical]
public static IntPtr StringToCoTaskMemAuto (string s);
static member StringToCoTaskMemAuto : string -> nativeint
[<System.Security.SecurityCritical>]
static member StringToCoTaskMemAuto : string -> nativeint
Public Shared Function StringToCoTaskMemAuto (s As String) As IntPtr
매개 변수
- s
- String
복사할 관리되는 문자열입니다.A managed string to be copied.
반환
할당된 메모리 블록이거나 s
가 null
인 경우 0입니다.The allocated memory block, or 0 if s
is null
.
- 특성
예외
사용 가능한 메모리가 부족한 경우There is insufficient memory available.
s
의 길이가 범위를 벗어난 경우The length for s
is out of range.
설명
StringToCoTaskMemAuto 는 관리 코드와 비관리 코드를 혼합할 때 사용자 지정 마샬링 또는 사용에 유용 합니다.StringToCoTaskMemAuto is useful for custom marshaling or for use when mixing managed and unmanaged code. 이 메서드는 문자열에 필요한 관리 되지 않는 메모리를 할당 하므로 항상를 호출 하 여 메모리를 비웁니다 FreeCoTaskMem .Because this method allocates the unmanaged memory required for a string, always free the memory by calling FreeCoTaskMem. 이 메서드는의 반대 기능을 제공 합니다 Marshal.PtrToStringAuto .This method provides the opposite functionality of Marshal.PtrToStringAuto.
문자열의 문자는 유니코드 문자로 복사 됩니다.The characters of the string are copied as Unicode characters.