Click or drag to resize

ExtendedHostFunctionslib(HostTypeCollection, String) Method

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.4.5
Syntax
public HostTypeCollection lib(
	HostTypeCollection collection,
	params string[] assemblyNames
)

Parameters

collection  HostTypeCollection
The host type collection with which to merge types from the specified assemblies.
assemblyNames  String
The names of the assemblies that contain the types to import.

Return Value

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.
Example
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