ClearScript Library
ClearScript Library
ClearScript Library Reference
Microsoft.ClearScript
HostFunctions Class
HostFunctions Methods
asType<T> Method
cast<T> Method
del<T> Method
flags<T> Method
func Method
getElement Method
getProperty Method
isNull Method
isType<T> Method
isTypeObj Method
newArr Method
newObj Method
newVar<T> Method
proc Method
removeElement Method
removeProperty Method
setElement Method
setProperty Method
toByte Method
toChar Method
toDecimal Method
toDouble Method
toInt16 Method
toInt32 Method
toInt64 Method
toSByte Method
toSingle Method
toStaticType Method
toUInt16 Method
toUInt32 Method
toUInt64 Method
tryCatch Method
typeOf Method

# HostFunctionsflags T Method

Creates a strongly typed flag set.
Namespace: Microsoft.ClearScript
Assembly: ClearScript.Core (in ClearScript.Core.dll) Version: 7.5.0
Syntax
C#
VB
C++
F#
Copy

    public T flags<T>(
    	params T[] args
    )

    Public Function flags(Of T) (
    	ParamArray args As T()
    ) As T

    public:
    generic<typename T>
    T flags(
    	... array<T>^ args
    )

    member flags :
            args : 'T[] -> 'T

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

    // 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

#### Reference

HostFunctions Class
Microsoft.ClearScript Namespace
type(String, String, Object)

Copyright © Microsoft Corporation. All rights reserved.

Send comments on this topic to Microsoft