Documentation

NET.addAssembly

Package:NET

Make .NET assembly visible toMATLAB

Syntax

asmInfo = NET.addAssembly(globalName)
asmInfo = NET.addAssembly(privateName)

Description

asmInfo= NET.addAssembly(globalName)loads a global .NET assembly into MATLAB®.

asmInfo= NET.addAssembly(privateName)loads a private .NET assembly.

Limitations

  • NET.addAssemblydoes not support assemblies generated by theMATLAB Compiler SDK™product.

Input Arguments

globalName

One of the following:

  • String or character vector representing the name of a global assembly.

  • Instance ofSystem.Reflection.AssemblyNameclass.

privateName

String or character vector representing the full path of a private assembly.

Output Arguments

asmInfo

NET.Assembly对象包含names of the members of the assembly.

Examples

Display today’s date usingSystem.DateTimein themscorlibassembly.

System.DateTime.Now.ToLongDateString

Call theSystem.Windows.Forms.MessageBox.Showmethod in the global assemblySystem.Windows.Forms.

asm = NET.addAssembly('System.Windows.Forms'); importSystem.Windows.Forms.*MessageBox.Show('Simple Message Box')

Display classes in the private assemblyNetSample.dll.

asm = NET.addAssembly('c:\work\NetSample.dll'); asm.Classes

Tips

  • You do not need to callNET.addAssemblyto access classes in themscorlib.dllandsystem.dllassemblies. MATLAB dynamically loads these assemblies from the .NET Framework class library the first time you type "NET." or "System.".

  • Refer to your .NET product documentation for the name of the assembly and its deployment type (global or private).

Introduced in R2009a

Was this topic helpful?