<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>The DOTNET class</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="class.com.html">COM</a></div> <div class="next" style="text-align: right; float: right;"><a href="class.variant.html">VARIANT</a></div> <div class="up"><a href="book.com.html">COM</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="class.dotnet" class="reference"> <h1 class="title">The DOTNET class</h1> <div class="partintro"><p class="verinfo">(PHP 4 >= 4.1.0, PHP 5)</p> <div class="section" id="class.dotnet.class"> <h2 class="title">Description</h2> <p class="simpara"> The DOTNET class allows you to instantiate a class from a .Net assembly and call its methods and access its properties. </p> <p class="simpara"> <em>$obj = new DOTNET("assembly", "classname")</em> </p> </div> <div class="section" id="dotnet.dotnet"> <h2 class="title">Methods</h2> <div class="methodsynopsis dc-description"> <span class="methodname"><strong>DOTNET::DOTNET</strong></span> ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$assembly_name</code></span> , <span class="methodparam"><span class="type">string</span> <code class="parameter">$class_name</code></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$codepage</code></span> ] )</div> <p class="para"> DOTNET class constructor. <em><code class="parameter">assembly_name</code></em> specifies which assembly should be loaded, and <em><code class="parameter">class_name</code></em> specifices which class in that assembly to instantiate. You may optionally specify a <em><code class="parameter">codepage</code></em> to use for unicode string transformations; see the <a href="class.com.html" class="xref">COM</a> class for more details on code pages. </p> <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> <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"><?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">-></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">-></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">-></span><span style="color: #0000BB">Pop</span><span style="color: #007700">() . </span><span style="color: #0000BB">$stack</span><span style="color: #007700">-></span><span style="color: #0000BB">Pop</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> </div> </p> <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para"> You need to install the .Net runtime on your web server to take advantage of this feature. </p> </p></blockquote> </div> </div> </div> <hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="class.com.html">COM</a></div> <div class="next" style="text-align: right; float: right;"><a href="class.variant.html">VARIANT</a></div> <div class="up"><a href="book.com.html">COM</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>