Marshal.StringToCoTaskMemAnsi(String) 메서드
정의
public:
static IntPtr StringToCoTaskMemAnsi(System::String ^ s);
[System.Security.SecurityCritical]
public static IntPtr StringToCoTaskMemAnsi (string s);
public static IntPtr StringToCoTaskMemAnsi (string? s);
public static IntPtr StringToCoTaskMemAnsi (string s);
[<System.Security.SecurityCritical>]
static member StringToCoTaskMemAnsi : string -> nativeint
static member StringToCoTaskMemAnsi : string -> nativeint
Public Shared Function StringToCoTaskMemAnsi (s As String) As IntPtr
매개 변수
- s
- String
복사할 관리되는 문자열입니다.A managed string to be copied.
반환
문자열에 할당된 메모리 블록에 대한 포인터를 나타내는 정수이거나 s
가 null
인 경우 0입니다.An integer representing a pointer to the block of memory allocated for the string, or 0 if s
is null
.
- 특성
예외
사용 가능한 메모리가 부족한 경우There is insufficient memory available.
s
매개 변수가 운영 체제에서 허용되는 최대 길이를 초과하는 경우The s
parameter exceeds the maximum length allowed by the operating system.
설명
StringToCoTaskMemAnsi 는 사용자 지정 마샬링 또는 관리 코드와 비관리 코드를 혼합할 때 유용 합니다.StringToCoTaskMemAnsi is useful for custom marshaling or 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.PtrToStringAnsi .This method provides the opposite functionality of Marshal.PtrToStringAnsi. 문자열의 문자는 ANSI 문자로 복사 됩니다.The characters of the string are copied as ANSI characters.