StringOrAudioSinkOptions Struct

The (DOMString or AudioSinkOptions) union of the audio output device requested for an AudioContext (https://webaudio.github.io/web-audio-api/#dom-audiocontextoptions-sinkid): the identifier of a device (the empty string for the default device), or the options of a sink without device.

public readonly struct StringOrAudioSinkOptions : IEquatable<StringOrAudioSinkOptions>
Implements

Properties

NameDescription
DeviceIdGets the identifier of the device when the value is a string, otherwise null.
OptionsGets the options when the value is an AudioSinkOptions, otherwise null.
ValueGets the value: a String or an AudioSinkOptions.

Gets the identifier of the device when the value is a string, otherwise null.

public string? DeviceId { get; }

Property value

string?

Gets the options when the value is an AudioSinkOptions, otherwise null.

public AudioSinkOptions? Options { get; }

Property value

AudioSinkOptions?

Gets the value: a String or an AudioSinkOptions.

public object Value { get; }

Property value

object

Methods

NameDescription
Equals(StringOrAudioSinkOptions)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.
FromAudioSinkOptions(AudioSinkOptions)Creates the union from sink options.
FromString(string)Creates the union from the identifier of a device.
GetHashCode()Returns the hash code for this instance.

Equals overloads

Equals(StringOrAudioSinkOptions)

AudioContextUnions.cs

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

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

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

Equals(object?)

AudioContextUnions.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.

FromAudioSinkOptions(AudioSinkOptions)

AudioContextUnions.cs

Creates the union from sink options.

public static StringOrAudioSinkOptions FromAudioSinkOptions(AudioSinkOptions value)

FromString(string)

AudioContextUnions.cs

Creates the union from the identifier of a device.

public static StringOrAudioSinkOptions FromString(string value)

Parameters

value string

Returns

StringOrAudioSinkOptions

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 ==(StringOrAudioSinkOptions, StringOrAudioSinkOptions)Returns whether the two unions hold the same value.
implicit operator StringOrAudioSinkOptions(AudioSinkOptions)Converts sink options to the union.
implicit operator StringOrAudioSinkOptions(string)Converts the identifier of a device to the union.
operator !=(StringOrAudioSinkOptions, StringOrAudioSinkOptions)Returns whether the two unions hold different values.

operator ==(StringOrAudioSinkOptions, StringOrAudioSinkOptions)

AudioContextUnions.cs

Returns whether the two unions hold the same value.

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

op_Implicit overloads

implicit operator StringOrAudioSinkOptions(AudioSinkOptions)

AudioContextUnions.cs

Converts sink options to the union.

public static implicit operator StringOrAudioSinkOptions(AudioSinkOptions value)

implicit operator StringOrAudioSinkOptions(string)

AudioContextUnions.cs

Converts the identifier of a device to the union.

public static implicit operator StringOrAudioSinkOptions(string value)
Parameters
value string
Returns

StringOrAudioSinkOptions

operator !=(StringOrAudioSinkOptions, StringOrAudioSinkOptions)

AudioContextUnions.cs

Returns whether the two unions hold different values.

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