.NET: Static Methods and Static Fields

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  Appendices > XSLT and XPath/XQuery Functions > Miscellaneous Extension Functions > .NET Extension Functions >

.NET: Static Methods and Static Fields

A static method is called directly by its name and by supplying the arguments for the method. The name used in the call must exactly match a public static method in the class specified. If the method name and the number of arguments that were given in the function call matches more than one method in a class, then the types of the supplied arguments are evaluated for the best match. If a match cannot be found unambiguously, an error is reported.

 

Note:A field in a .NET class is considered to be a method without any argument. A property is called using the syntax get_PropertyName().

 

Examples

An XSLT example showing a call to a method with one argument (System.Math.Sin(arg)):

<xsl:value-of select="math:Sin(30)" xmlns:math="clitype:System.Math"/>

 

 

An XSLT example showing a call to a field (considered a method with no argument) (System.Double.MaxValue()):

<xsl:value-of select="double:MaxValue()" xmlns:double="clitype:System.Double"/>

 

 

An XSLT example showing a call to a property (syntax is get_PropertyName()) (System.String()):

<xsl:value-of select="string:get_Length('my string')" xmlns:string="clitype:System.String"/>

 

 

An XQuery example showing a call to a method with one argument (System.Math.Sin(arg)):

<sin xmlns:math="clitype:System.Math">

   { math:Sin(30) }

</sin>

 


© 2019 Altova GmbH