# C1.Util.DX.ComObject.As

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Util_DX_ComObject_As_" data-uid="C1.Util.DX.ComObject.As*">As Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Util_DX_ComObject_As_" data-uid="C1.Util.DX.ComObject.As*"></a>
<h4 id="C1_Util_DX_ComObject_As__1_System_Object_" data-uid="C1.Util.DX.ComObject.As``1(System.Object)">As&lt;T&gt;(object)</h4>
<div class="markdown level1 summary"><p>Queries a managed object for a particular COM interface support (This method is a shortcut to <a class="xref" href="C1.Util.DX.ComObject.QueryInterface.html#C1_Util_DX_ComObject_QueryInterface_System_Guid_System_IntPtr__">QueryInterface(Guid, out IntPtr)</a>)</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static T As&lt;T&gt;(object comObject) where T : ComObject</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function [As](Of T As ComObject)(comObject As Object) As T</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></td>
      <td><span class="parametername">comObject</span></td>
      <td><p>The managed COM object.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><span class="xref">T</span></td>
      <td><p>An instance of the queried interface</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="typeParameters">Type Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><span class="parametername">T</span></td>
      <td><p>The type of the COM interface to query</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_Util_DX_ComObject_As_" data-uid="C1.Util.DX.ComObject.As*"></a>
<h4 id="C1_Util_DX_ComObject_As__1_System_IntPtr_" data-uid="C1.Util.DX.ComObject.As``1(System.IntPtr)">As&lt;T&gt;(IntPtr)</h4>
<div class="markdown level1 summary"><p>Queries a managed object for a particular COM interface support (This method is a shortcut to <a class="xref" href="C1.Util.DX.ComObject.QueryInterface.html#C1_Util_DX_ComObject_QueryInterface_System_Guid_System_IntPtr__">QueryInterface(Guid, out IntPtr)</a>)</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static T As&lt;T&gt;(IntPtr iunknownPtr) where T : ComObject</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function [As](Of T As ComObject)(iunknownPtr As IntPtr) As T</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.intptr">IntPtr</a></td>
      <td><span class="parametername">iunknownPtr</span></td>
      <td><p>The managed COM object.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><span class="xref">T</span></td>
      <td><p>An instance of the queried interface</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="typeParameters">Type Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><span class="parametername">T</span></td>
      <td><p>The type of the COM interface to query</p>
</td>
    </tr>
  </tbody>
</table>
</div>
