たとえば、古い.NET Framework 2.0ソースコード(Windowsフォーム、Visual Studio 2005-Whidbey)では、 GetClientRect関数はHandleRefを使用して定義されていました。
[DllImport(ExternDll.User32, ExactSpelling=true, CharSet=CharSet.Auto)]
public static extern bool GetClientRect(HandleRef hWnd, [In, Out] ref NativeMethods.RECT rect);
新しいWindowsAPIコードパック(Microsoft、2009/2010から)では、同じ関数がIntPtrを使用して定義されています。
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool GetClientRect(IntPtr hwnd, ref CoreNativeMethods.RECT rect);
実際、 HandleRefはWindows APIコードパックのソースファイルでは使用されていませんが、古い.NETFrameworkソースファイルのネイティブメソッドの署名では頻繁に使用されていました。