Click or drag to resize

HostFunctionsflagsT Method

Creates a strongly typed flag set.

Namespace: Microsoft.ClearScript
Assembly: ClearScript.Core (in ClearScript.Core.dll) Version: 7.4.5
Syntax
public T flags<T>(
	params T[] args
)

Parameters

args  T
The flags to include in the flag set.

Type Parameters

T
The type of flag set to create.

Return Value

T
A strongly typed flag set containing the specified flags.
Remarks
This function throws an exception if T is not a flag set type.
Example
The following code demonstrates using a strongly typed flag set. It assumes that an instance of ExtendedHostFunctions is exposed under the name "host" (see AddHostObject).
JavaScript
// import URI types
var UriT = host.type("System.Uri", "System");
var UriFormatT = host.type("System.UriFormat", "System");
var UriComponentsT = host.type("System.UriComponents", "System");
// create a URI
var uri = host.newObj(UriT, "http://www.example.com:8080/path/to/file/sample.htm?x=1&y=2");
// extract URI components
var components = host.flags(UriComponentsT.Scheme, UriComponentsT.Host, UriComponentsT.Path);
var result = uri.GetComponents(components, UriFormatT.Unescaped);
See Also