<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/book.com.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'class.dotnet.php',
    1 => 'dotnet',
    2 => 'The dotnet class',
  ),
  'up' => 
  array (
    0 => 'book.com.php',
    1 => 'COM',
  ),
  'prev' => 
  array (
    0 => 'com.construct.php',
    1 => 'com::__construct',
  ),
  'next' => 
  array (
    0 => 'dotnet.construct.php',
    1 => 'dotnet::__construct',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/com/dotnet.xml',
  ),
  'history' => 
  array (
  ),
  'extra_header_links' => 
  array (
    'rel' => 'alternate',
    'href' => '/manual/en/feeds/class.dotnet.atom',
    'type' => 'application/atom+xml',
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="class.dotnet" class="reference">
 
 <h1 class="title">The dotnet class</h1>
 <div class="partintro"><p class="verinfo">(PHP 4 &gt;= 4.1.0, PHP 5, PHP 7, PHP 8)</p>


  <div class="section" id="dotnet.intro">
   <h2 class="title">Introduzione</h2>
   <p class="para">
    The dotnet class allows you to instantiate a class from a .Net assembly and
    call its methods and access its properties, if the class and the methods and
    properties are <a href="https://docs.microsoft.com/dotnet/api/system.runtime.interopservices.comvisibleattribute" class="link external">&raquo;&nbsp;visible to COM</a>.
   </p>
   <p class="para">
    Neither instantiating static classes nor calling static methods is supported.
    Instantiating generic classes such as <code class="literal">System.Collections.Generic.List</code>
    is not supported either.
   </p>
   <p class="para">
    Some .Net classes do not implement IDispatch, so while they can be instantiated,
    calling methods or accessing properties on these classes is not supported.
   </p>
   <blockquote class="note"><p><strong class="note">Nota</strong>: 
    <p class="para">
     You need to install the .Net runtime on your web server to take advantage
     of this feature.
    </p>
   </p></blockquote>
   <blockquote class="note"><p><strong class="note">Nota</strong>: 
    <p class="para">
     Prior to PHP 8.0.0, .Net framework 4.0 and later were not supported by the <span class="classname"><strong class="classname">dotnet</strong></span>
     class. If assemblies had been registered with <strong class="command">regasm.exe</strong>,
     the classes could be instantiated as <span class="classname"><a href="class.com.php" class="classname">com</a></span> objects, though.
     As of PHP 8.0.0, .Net framework 4.0 and later are supported via the <var class="filename">php.ini</var>
     directive <a href="com.configuration.php#ini.com.dotnet-version" class="link">com.dotnet_version</a>.
    </p>
   </p></blockquote>
  </div>


  <div class="section" id="dotnet.synopsis">
   <h2 class="title">Sommario della classe</h2>


   <div class="classsynopsis"><div class="classsynopsisinfo">
    
     <span class="modifier">class</span> <strong class="classname"><strong class="classname">dotnet</strong></strong>
    

    
     <span class="modifier">extends</span>
      <a href="class.variant.php" class="classname">variant</a>
     {</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Metodi */</div>
    <div class="constructorsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><a href="dotnet.construct.php" class="methodname">__construct</a></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$assembly_name</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$datatype_name</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$codepage</code><span class="initializer"> = <strong><code><a href="com.constants.php#constant.cp-acp">CP_ACP</a></code></strong></span></span>)</div>

   }</div>


  </div>

  <div class="section" id="class.dotnet.overloadedmethods">
   <h2 class="title">Overloaded Methods</h2>
   <p class="para">
    The returned object is an overloaded object, which means that PHP does
    not see any fixed methods as it does with regular classes; instead, any
    property or method accesses are passed through to COM and from there to
    DOTNET.  In other words, the .Net object is mapped through the COM
    interoperability layer provided by the .Net runtime.
   </p>
   <p class="para">
    Once you have created a dotnet object, PHP treats it identically to any
    other COM object; all the same rules apply.
   </p>
  </div>

  <div class="section" id="class.dotnet.examples">
   <h2 class="title">dotnet examples</h2>
   <p class="para">
    <div class="example" id="example.dotnet">
     <p><strong>Example #1 dotnet example</strong></p>
     <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$stack </span><span style="color: #007700">= new </span><span style="color: #0000BB">dotnet</span><span style="color: #007700">(</span><span style="color: #DD0000">"mscorlib"</span><span style="color: #007700">, </span><span style="color: #DD0000">"System.Collections.Stack"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$stack</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">Push</span><span style="color: #007700">(</span><span style="color: #DD0000">".Net"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$stack</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">Push</span><span style="color: #007700">(</span><span style="color: #DD0000">"Hello "</span><span style="color: #007700">);<br />echo </span><span style="color: #0000BB">$stack</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">Pop</span><span style="color: #007700">() . </span><span style="color: #0000BB">$stack</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">Pop</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
     </div>

    </div>
   </p>
  </div>

 </div>

 





<h2>Indice dei contenuti</h2><ul class="chunklist chunklist_reference"><li><a href="dotnet.construct.php">dotnet::__construct</a> — dotnet class constructor</li></ul>
</div>
<?php manual_footer($setup); ?>