HostFunctionsflagsT Method |
Creates a strongly typed flag set.
Namespace: Microsoft.ClearScriptAssembly: ClearScript.Core (in ClearScript.Core.dll) Version: 7.4.5
Syntax 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
TA 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).
var UriT = host.type("System.Uri", "System");
var UriFormatT = host.type("System.UriFormat", "System");
var UriComponentsT = host.type("System.UriComponents", "System");
var uri = host.newObj(UriT, "http://www.example.com:8080/path/to/file/sample.htm?x=1&y=2");
var components = host.flags(UriComponentsT.Scheme, UriComponentsT.Host, UriComponentsT.Path);
var result = uri.GetComponents(components, UriFormatT.Unescaped);
See Also