Altova StyleVision 2023 Enterprise Edition

Imports a namespace. This is the scripting equivalent of C# using and VB.Net imports keyword. Calling CLR.Import makes it possible to leave out the namespace part in subsequent calls like CLR.Create() and CLR.Static().

 

Note:Importing a namespace does not add or load the corresponding assembly to the scripting project. You can add assemblies to the scripting project dynamically (at runtime) in the source code by calling CLR.LoadAssembly.

 

Signature

CLR.Import(strNamespaceCLR : String) -> void

 

Example

Instead of having to use fully qualified namespaces like:

 

if ( ShowForm( "FormName" ) == CLR.Static( "System.Windows.Forms.DialogResult" ).OK )
{
   var sName = lastform.textboxFirstName.Text + " " + lastform.textboxLastName.Text;
   CLR.Static( "System.Windows.Forms.MessageBox" ).Show( "Hello " + sName );

}

 

One can import namespaces first and subsequently use the short form:

 

CLR.Import( "System.Windows.Forms" );

 

if ( ShowForm( "FormName" ) == CLR.Static( "DialogResult" ).OK )
{
   var sName = lastform.textboxFirstName.Text + " " + lastform.textboxLastName.Text;
   CLR.Static( "MessageBox" ).Show( "Hello " + sName );
}

© 2017-2023 Altova GmbH