<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="../../make-menu.xsl" type="text/xsl"?><html>
   <head>
      <this-is section="extensibility" page="dotnetextensions" subpage="constructors.net"/>
      <!--
           Generated at 2010-10-29T18:20:48.427+01:00--><title>Saxonica: XSLT and XQuery Processing: Calling .NET Constructors</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title"
            content="Saxonica: XSLT and XQuery Processing: Calling .NET Constructors"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>Calling .NET Constructors</h1>
      <p><b>.NET class constructors</b> are called by using the function named <code>new()</code>. 
If there are several constructors, then again
the system tries to find the one that is the best fit, according to the types of the supplied arguments. The result
 of calling <code>new()</code> is an XPath value whose type is denoted by a QName whose local name
 is the actual .NET class (for example <code>System.Data.SqlClient.SqlConnection</code> 
 or <code>System.Collections.ArrayList</code>)
 and whose namespace
 URI is <code>http://saxon.sf.net/clitype</code>. 
 The only things that can be done with a wrapped .NET Object
 are to assign it to a variable, to pass it to an extension function, and to convert it to a string
 or boolean, using the rules given below.</p>
      <p>The use of external object types in namespace <code>http://saxon.sf.net/clitype</code> reflects the
.NET type hierarchy. For example, if a variable is declared to accept a type of <code>net:System.Collections.IList</code>, then
a value of type <code>net:System.Collections.ArrayList</code> will be accepted, 
but a value of type <code>net:System.Collections.HashTable</code>
will not.</p>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="instance-methods.net.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>