本文整理匯總了C#中System.IntPtr.PtrToString方法的典型用法代碼示例。如果您正苦於以下問題:C# IntPtr.PtrToString方法的具體用法?C# IntPtr.PtrToString怎麽用?C# IntPtr.PtrToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.IntPtr
的用法示例。
在下文中一共展示了IntPtr.PtrToString方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: FromIntPtr
public void FromIntPtr(IntPtr ptr)
{
Value = ptr.PtrToString ();
}
示例2: CompareCallback
/// <summary>
/// Internal collation sequence function, which wraps up the raw string pointers and executes the Compare() virtual function.
/// </summary>
/// <param name="len1">Length of the string pv1</param>
/// <param name="ptr1">Pointer to the first string to compare</param>
/// <param name="len2">Length of the string pv2</param>
/// <param name="ptr2">Pointer to the second string to compare</param>
/// <returns>Returns -1 if the first string is less than the second. 0 if they are equal, or 1 if the first string is greater
/// than the second.</returns>
internal int CompareCallback(int len1, IntPtr ptr1, int len2, IntPtr ptr2)
{
return Compare(ptr1.PtrToString (), ptr2.PtrToString ());
}