MediaListOrString Struct

The (MediaList or DOMString) union.

public readonly struct MediaListOrString : IEquatable<MediaListOrString>
Implements

Properties

NameDescription
MediaListGets the value as a MediaListOrString.MediaList, or null when the value is a string.
StringValueGets the value as a string, or null when the value is a MediaListOrString.MediaList.
ValueGets the underlying value, either a MediaListOrString.MediaList or a string.

Gets the value as a MediaListOrString.MediaList, or null when the value is a string.

public MediaList? MediaList { get; }

Property value

MediaList?

StringValue

CssStyleSheet.cs

Gets the value as a string, or null when the value is a MediaListOrString.MediaList.

public string? StringValue { get; }

Property value

string?

Gets the underlying value, either a MediaListOrString.MediaList or a string.

public object Value { get; }

Property value

object

Methods

NameDescription
Equals(MediaListOrString)Returns whether the other union value wraps the same value.
Equals(object?)Indicates whether this instance and a specified object are equal.
FromMediaList(MediaList)Creates a union value from a MediaListOrString.MediaList.
FromString(string)Creates a union value from a string.
GetHashCode()Returns the hash code for this instance.

Equals overloads

Equals(MediaListOrString)

CssStyleSheet.cs

Returns whether the other union value wraps the same value.

public bool Equals(MediaListOrString other)
Parameters
other MediaListOrString
Returns

bool

Equals(object?)

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

FromMediaList(MediaList)

CssStyleSheet.cs

Creates a union value from a MediaListOrString.MediaList.

public static MediaListOrString FromMediaList(MediaList value)

Parameters

value MediaList

Returns

MediaListOrString

FromString(string)

CssStyleSheet.cs

Creates a union value from a string.

public static MediaListOrString FromString(string value)

Parameters

value string

Returns

MediaListOrString

GetHashCode()

CssStyleSheet.cs

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 ==(MediaListOrString, MediaListOrString)Returns whether the two union values wrap the same value.
implicit operator MediaListOrString(MediaList)Creates a union value from a MediaListOrString.MediaList.
implicit operator MediaListOrString(string)Creates a union value from a string.
operator !=(MediaListOrString, MediaListOrString)Returns whether the two union values wrap different values.

operator ==(MediaListOrString, MediaListOrString)

CssStyleSheet.cs

Returns whether the two union values wrap the same value.

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

Parameters

left MediaListOrString
right MediaListOrString

Returns

bool

op_Implicit overloads

implicit operator MediaListOrString(MediaList)

CssStyleSheet.cs

Creates a union value from a MediaListOrString.MediaList.

public static implicit operator MediaListOrString(MediaList value)
Parameters
value MediaList
Returns

MediaListOrString

implicit operator MediaListOrString(string)

CssStyleSheet.cs

Creates a union value from a string.

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

MediaListOrString

operator !=(MediaListOrString, MediaListOrString)

CssStyleSheet.cs

Returns whether the two union values wrap different values.

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

Parameters

left MediaListOrString
right MediaListOrString

Returns

bool