StringOrAudioSinkInfo Struct

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

public readonly struct StringOrAudioSinkInfo : IEquatable<StringOrAudioSinkInfo>
Implements

Properties

NameDescription
DeviceIdGets the identifier of the device when the value is a string, otherwise null.
InfoGets the information of the sink when the value is an AudioSinkInfo, otherwise null.
ValueGets the value: a String or an AudioSinkInfo.

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

public string? DeviceId { get; }

Property value

string?

Gets the information of the sink when the value is an AudioSinkInfo, otherwise null.

public AudioSinkInfo? Info { get; }

Property value

AudioSinkInfo?

Gets the value: a String or an AudioSinkInfo.

public object Value { get; }

Property value

object

Methods

NameDescription
Equals(StringOrAudioSinkInfo)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.
FromAudioSinkInfo(AudioSinkInfo)Creates the union from the information of a sink.
FromString(string)Creates the union from the identifier of a device.
GetHashCode()Returns the hash code for this instance.

Equals overloads

Equals(StringOrAudioSinkInfo)

AudioContextUnions.cs

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

public bool Equals(StringOrAudioSinkInfo other)
Parameters
other StringOrAudioSinkInfo
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.

FromAudioSinkInfo(AudioSinkInfo)

AudioContextUnions.cs

Creates the union from the information of a sink.

public static StringOrAudioSinkInfo FromAudioSinkInfo(AudioSinkInfo value)

Parameters

value AudioSinkInfo

Returns

StringOrAudioSinkInfo

FromString(string)

AudioContextUnions.cs

Creates the union from the identifier of a device.

public static StringOrAudioSinkInfo FromString(string value)

Parameters

value string

Returns

StringOrAudioSinkInfo

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

operator ==(StringOrAudioSinkInfo, StringOrAudioSinkInfo)

AudioContextUnions.cs

Returns whether the two unions hold the same value.

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

op_Implicit overloads

implicit operator StringOrAudioSinkInfo(AudioSinkInfo)

AudioContextUnions.cs

Converts the information of a sink to the union.

public static implicit operator StringOrAudioSinkInfo(AudioSinkInfo value)
Parameters
value AudioSinkInfo
Returns

StringOrAudioSinkInfo

implicit operator StringOrAudioSinkInfo(string)

AudioContextUnions.cs

Converts the identifier of a device to the union.

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

StringOrAudioSinkInfo

operator !=(StringOrAudioSinkInfo, StringOrAudioSinkInfo)

AudioContextUnions.cs

Returns whether the two unions hold different values.

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