Click or drag to resize

ExtendedHostFunctionslib Method (HostTypeCollection, String)

Imports types from one or more host assemblies and merges them with an existing host type collection.

Namespace:  Microsoft.ClearScript
Assembly:  ClearScript.Core (in ClearScript.Core.dll) Version: 7.2.5
Syntax
public HostTypeCollection lib(
	HostTypeCollection collection,
	params string[] assemblyNames
)

Parameters

collection
Type: Microsoft.ClearScriptHostTypeCollection
The host type collection with which to merge types from the specified assemblies.
assemblyNames
Type: SystemString
The names of the assemblies that contain the types to import.

Return Value

Type: HostTypeCollection
A host type collection: collection if it is not null, a new host type collection otherwise.
Remarks
Host type collections provide convenient scriptable access to all the types defined in one or more host assemblies. They are hierarchical collections where leaf nodes represent types and parent nodes represent namespaces. For example, if an assembly contains a type named "Acme.Gadgets.Button", the corresponding collection will have a property named "Acme" whose value is an object with a property named "Gadgets" whose value is an object with a property named "Button" whose value represents the Acme.Gadgets.Button host type.
Examples
The following code imports types from several core assemblies and uses Enumerable to create an array of integers. It assumes that an instance of ExtendedHostFunctions is exposed under the name "host" (see AddHostObject).
JavaScript
var clr = host.lib("mscorlib");
host.lib(clr, "System");
host.lib(clr, "System.Core");
var array = clr.System.Linq.Enumerable.Range(0, 5).ToArray();
See Also