.NET Terminology

A namespace is a way to group identifiers. A namespace can contain other namespaces. In MATLAB®, a namespace is a package. In MATLAB, a .NET type is a class.

The syntax namespace.ClassName is known as a fully qualified name.

.NET Framework System Namespace

System is the root namespace for fundamental types in the .NET Framework. This namespace also contains classes (for example, System.String and System.Array) and second-level namespaces (for example, System.Collections.Generic). The mscorlib and system assemblies, which MATLAB loads at startup, contain many, but not all System namespaces. For example, to use classes in the System.Xml namespace, load the system.xml assembly using the NET.addAssembly command. Refer to the Microsoft® .NET Framework Class Library Reference to learn what assembly to use for a specific namespace.

Reference Type Versus Value Type

Objects created from .NET classes (for example, the System.Reflection.Assembly class) appear in MATLAB as reference types, or handle objects. Objects created from .NET structures (for example, the System.DateTime structure) appear as value types. You use the same MATLAB syntax to create and access members of classes and structures.

However, handle objects are different from value objects. When you copy a handle object, only the handle is copied and both the old and new handles refer to the same data. When you copy a value object, the object data is also copied and the new object is independent of changes to the original object. For more information about these differences, see Object Behavior.

Do not confuse an object created from a .NET structure with a MATLAB structure array (see Structures). You cannot pass a structure array to a .NET method.