RouterSource Struct

The (RouterSourceDict or RouterSourceEnum) union (https://w3c.github.io/ServiceWorker/#typedefdef-routersource).

public readonly struct RouterSource : IEquatable<RouterSource>
Implements

Properties

NameDescription
DictionaryGets the value as a RouterSourceDict, or null when the union holds a RouterSourceKind.
KindGets the value as a RouterSourceKind, or null when the union holds a RouterSourceDict.
ValueGets the value of the union: a RouterSourceDict or a RouterSourceKind.

Gets the value as a RouterSourceDict, or null when the union holds a RouterSourceKind.

public RouterSourceDict? Dictionary { get; }

Property value

RouterSourceDict?

Gets the value as a RouterSourceKind, or null when the union holds a RouterSourceDict.

public RouterSourceKind? Kind { get; }

Property value

RouterSourceKind?

Gets the value of the union: a RouterSourceDict or a RouterSourceKind.

public object Value { get; }

Property value

object

Methods

NameDescription
Equals(RouterSource)Indicates whether the current object is equal to another object of the same type.
Equals(object?)Indicates whether this instance and a specified object are equal.
FromRouterSourceDict(RouterSourceDict)Creates the union from a cache source.
FromRouterSourceKind(RouterSourceKind)Creates the union from a kind of source.
GetHashCode()Returns the hash code for this instance.

Equals overloads

Equals(RouterSource)

ServiceWorkerRouter.cs

Indicates whether the current object is equal to another object of the same type.

public bool Equals(RouterSource other)
Parameters
other RouterSource
An object to compare with this object.
Returns

bool true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

ServiceWorkerRouter.cs

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)
Parameters
obj object?
The object to compare with the current instance.
Returns

bool true if obj and this instance are the same type and represent the same value; otherwise, false.

FromRouterSourceDict(RouterSourceDict)

ServiceWorkerRouter.cs

Creates the union from a cache source.

public static RouterSource FromRouterSourceDict(RouterSourceDict value)

Parameters

value RouterSourceDict

Returns

RouterSource

FromRouterSourceKind(RouterSourceKind)

ServiceWorkerRouter.cs

Creates the union from a kind of source.

public static RouterSource FromRouterSourceKind(RouterSourceKind value)

Parameters

value RouterSourceKind

Returns

RouterSource

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int A 32-bit signed integer that is the hash code for this instance.

Operators

NameDescription
operator ==(RouterSource, RouterSource)Determines whether two unions are equal.
implicit operator RouterSource(RouterSourceDict)Converts a cache source to the union.
implicit operator RouterSource(RouterSourceKind)Converts a kind of source to the union.
operator !=(RouterSource, RouterSource)Determines whether two unions are different.

operator ==(RouterSource, RouterSource)

ServiceWorkerRouter.cs

Determines whether two unions are equal.

public static bool operator ==(RouterSource left, RouterSource right)

Parameters

left RouterSource
right RouterSource

Returns

bool

op_Implicit overloads

implicit operator RouterSource(RouterSourceDict)

ServiceWorkerRouter.cs

Converts a cache source to the union.

public static implicit operator RouterSource(RouterSourceDict value)
Parameters
value RouterSourceDict
Returns

RouterSource

implicit operator RouterSource(RouterSourceKind)

ServiceWorkerRouter.cs

Converts a kind of source to the union.

public static implicit operator RouterSource(RouterSourceKind value)
Parameters
value RouterSourceKind
Returns

RouterSource

operator !=(RouterSource, RouterSource)

ServiceWorkerRouter.cs

Determines whether two unions are different.

public static bool operator !=(RouterSource left, RouterSource right)

Parameters

left RouterSource
right RouterSource

Returns

bool