Converting Wrapped .NET Objects

Saxon allows an extension function to return an arbitrary .NET object. This will then be wrapped as an XPath item, so that it can be held in a variable and passed subsequently as an argument to another extension function. This second extension function will see the original .NET object minus its wrapper, provided it is declared to expect the appropriate .NET class.

A wrapped .NET object may be converted to another data type as follows.

The type of a wrapped .NET object may be declared in a variable declaration or function signature using a type name whose namespace URI is http://saxon.sf.net/clitype, and whose local name is the fully qualified name of the .NET class, with any "$" signs replaced by hyphens. For example, the sql:connection extension function returns a value of type {http://saxon.sf.net/clitype}System.Data.SqlClient.SqlConnection.