ClearScript Library
ClearScript Library
ClearScript Library Reference
Microsoft.ClearScript
ExtendedHostFunctions Class
ExtendedHostFunctions Methods
lib Method
lib(String[]) Method
lib(HostTypeCollection, String[]) Method

# 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.5.0
Syntax
C#
VB
C++
F#
Copy

    public HostTypeCollection lib(
    	HostTypeCollection collection,
    	params string[] assemblyNames
    )

    Public Function lib (
    	collection As HostTypeCollection,
    	ParamArray assemblyNames As String()
    ) As HostTypeCollection

    public:
    HostTypeCollection^ lib(
    	HostTypeCollection^ collection,
    	... array<String^>^ assemblyNames
    )

    member lib :
            collection : HostTypeCollection *
            assemblyNames : string[] -> HostTypeCollection

#### 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
Copy

    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

#### Reference

ExtendedHostFunctions Class
lib Overload
Microsoft.ClearScript Namespace

Copyright © Microsoft Corporation. All rights reserved.

Send comments on this topic to Microsoft