﻿<?xml version="1.0" encoding="utf-8"?><Type Name="HandleRef" FullName="System.Runtime.InteropServices.HandleRef"><TypeSignature Maintainer="auto" Language="C#" Value="public struct HandleRef" /><TypeSignature Language="ILAsm" Value=".class public sequential ansi sealed beforefieldinit HandleRef extends System.ValueType" /><AssemblyInfo><AssemblyName>mscorlib</AssemblyName><AssemblyPublicKey>[00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00]</AssemblyPublicKey><AssemblyVersion>1.0.5000.0</AssemblyVersion><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the &lt;link location="node:gtk-sharp/programming/threads"&gt;Gtk# Thread Programming&lt;/link&gt; for details.</ThreadSafetyStatement><Base><BaseTypeName>System.ValueType</BaseTypeName></Base><Interfaces /><Attributes><Attribute><AttributeName>System.Runtime.InteropServices.ComVisible(true)</AttributeName></Attribute></Attributes><Docs><remarks><attribution license="cc4" from="Microsoft" modified="false" /><para>If you use platform invoke to call a managed object, and the object is not referenced elsewhere after the platform invoke call, it is possible for the garbage collector to finalize the managed object. This action releases the resource and invalidates the handle, causing the platform invoke call to fail. Wrapping a handle with <see cref="T:System.Runtime.InteropServices.HandleRef" /> guarantees that the managed object is not garbage collected until the platform invoke call completes. For a description of platform invoke services, see <format type="text/html"><a href="ECA7606E-EBFB-4F47-B8D9-289903FDC045">[&lt;topic://cpconconsumingunmanageddllfunctions&gt;]</a></format>.</para><para>The <see cref="T:System.Runtime.InteropServices.HandleRef" /> value type, like <see cref="T:System.Runtime.InteropServices.GCHandle" />, is a special type recognized by the interop marshaler. A normal, nonpinned <see cref="T:System.Runtime.InteropServices.GCHandle" /> also prevents untimely garbage collection, yet <see cref="T:System.Runtime.InteropServices.HandleRef" /> provides better performance. Although using <see cref="T:System.Runtime.InteropServices.HandleRef" /> to keep an object alive for the duration of a platform invoke call is preferred, you can also use the <see cref="M:System.GC.KeepAlive(System.Object)" /> method for the same purpose.</para><para>The <see cref="T:System.Runtime.InteropServices.HandleRef" /> constructor takes two parameters: an <see cref="T:System.Object" /> representing the wrapper, and an <see cref="T:System.IntPtr" /> representing the unmanaged handle. The interop marshaler passes only the handle to unmanaged code, and guarantees that the wrapper (passed as the first parameter to the constructor of the HandleRef) remains alive for the duration of the call.</para></remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>Wraps a managed object holding a handle to a resource that is passed to unmanaged code using platform invoke.</para></summary></Docs><Members><Member MemberName=".ctor"><MemberSignature Language="C#" Value="public HandleRef (object wrapper, IntPtr handle);" /><MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(object wrapper, native int handle) cil managed" /><MemberType>Constructor</MemberType><AssemblyInfo><AssemblyVersion>1.0.5000.0</AssemblyVersion><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><ReturnValue /><Parameters><Parameter Name="wrapper" Type="System.Object" /><Parameter Name="handle" Type="System.IntPtr" /></Parameters><Docs><remarks>To be added</remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>Initializes a new instance of the <see cref="T:System.Runtime.InteropServices.HandleRef" /> class with the object to wrap and a handle to the resource used by unmanaged code.</para></summary><param name="wrapper"><attribution license="cc4" from="Microsoft" modified="false" />A managed object that should not be finalized until the platform invoke call returns. </param><param name="handle"><attribution license="cc4" from="Microsoft" modified="false" />An <see cref="T:System.IntPtr" /> that indicates a handle to a resource. </param></Docs></Member><Member MemberName="Handle"><MemberSignature Language="C#" Value="public IntPtr Handle { get; }" /><MemberSignature Language="ILAsm" Value=".property instance native int Handle" /><MemberType>Property</MemberType><AssemblyInfo><AssemblyVersion>1.0.5000.0</AssemblyVersion><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><ReturnValue><ReturnType>System.IntPtr</ReturnType></ReturnValue><Docs><value>To be added: an object of type 'IntPtr'</value><remarks>To be added</remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>Gets the handle to a resource.</para></summary></Docs></Member><Member MemberName="op_Explicit"><MemberSignature Language="C#" Value="public static IntPtr op_Explicit (System.Runtime.InteropServices.HandleRef value);" /><MemberSignature Language="ILAsm" Value=".method public static hidebysig specialname native int op_Explicit(valuetype System.Runtime.InteropServices.HandleRef value) cil managed" /><MemberType>Method</MemberType><AssemblyInfo><AssemblyVersion>1.0.5000.0</AssemblyVersion><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><ReturnValue><ReturnType>System.IntPtr</ReturnType></ReturnValue><Parameters><Parameter Name="value" Type="System.Runtime.InteropServices.HandleRef" /></Parameters><Docs><param name="value">To be added.</param><summary>To be added.</summary><returns>To be added.</returns><remarks>To be added.</remarks></Docs></Member><Member MemberName="ToIntPtr"><MemberSignature Language="C#" Value="public static IntPtr ToIntPtr (System.Runtime.InteropServices.HandleRef value);" /><MemberSignature Language="ILAsm" Value=".method public static hidebysig native int ToIntPtr(valuetype System.Runtime.InteropServices.HandleRef value) cil managed" /><MemberType>Method</MemberType><AssemblyInfo><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><ReturnValue><ReturnType>System.IntPtr</ReturnType></ReturnValue><Parameters><Parameter Name="value" Type="System.Runtime.InteropServices.HandleRef" /></Parameters><Docs><remarks>To be added.</remarks><since version=".NET 2.0" /><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>Returns the internal integer representation of a <see cref="T:System.Runtime.InteropServices.HandleRef" /> object.</para></summary><returns><attribution license="cc4" from="Microsoft" modified="false" /><para>An <see cref="T:System.IntPtr" /> object that represents a <see cref="T:System.Runtime.InteropServices.HandleRef" /> object.</para></returns><param name="value"><attribution license="cc4" from="Microsoft" modified="false" />A <see cref="T:System.Runtime.InteropServices.HandleRef" /> object to retrieve an internal integer representation from.</param></Docs></Member><Member MemberName="Wrapper"><MemberSignature Language="C#" Value="public object Wrapper { get; }" /><MemberSignature Language="ILAsm" Value=".property instance object Wrapper" /><MemberType>Property</MemberType><AssemblyInfo><AssemblyVersion>1.0.5000.0</AssemblyVersion><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><ReturnValue><ReturnType>System.Object</ReturnType></ReturnValue><Docs><value>To be added: an object of type 'object'</value><remarks>To be added</remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>Gets the object holding the handle to a resource.</para></summary></Docs></Member></Members></Type>