ExtendedHostFunctionslib(String) Method |
Imports types from one or more host assemblies.
Namespace: Microsoft.ClearScriptAssembly: ClearScript.Core (in ClearScript.Core.dll) Version: 7.4.5
Syntax public HostTypeCollection lib(
params string[] assemblyNames
)
Public Function lib (
ParamArray assemblyNames As String()
) As HostTypeCollection
public:
HostTypeCollection^ lib(
... array<String^>^ assemblyNames
)
member lib :
assemblyNames : string[] -> HostTypeCollection
Parameters
- assemblyNames String
- The names of the assemblies that contain the types to import.
Return Value
HostTypeCollectionThe imported host type collection.
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).
var clr = host.lib("mscorlib", "System", "System.Core");
var array = clr.System.Linq.Enumerable.Range(0, 5).ToArray();
See Also