MediaListOrBoolean Struct

The (MediaList or boolean) union (https://drafts.csswg.org/mediaqueries-5/#typedefdef-custommediaquery).

public readonly struct MediaListOrBoolean : IEquatable<MediaListOrBoolean>
Implements

Properties

NameDescription
BooleanValueGets the boolean when the value is a boolean, otherwise null.
MediaListGets the media query list when the value is a media query list, otherwise null.
ValueGets the value: a MediaList or a Boolean.

BooleanValue

CSSRules.cs

Gets the boolean when the value is a boolean, otherwise null.

public bool? BooleanValue { get; }

Property value

bool?

MediaList

CSSRules.cs

Gets the media query list when the value is a media query list, otherwise null.

public MediaList? MediaList { get; }

Property value

MediaList?

Gets the value: a MediaList or a Boolean.

public object Value { get; }

Property value

object

Methods

NameDescription
Equals(MediaListOrBoolean)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.
FromBoolean(bool)Creates a union value from a boolean.
FromMediaList(MediaList)Creates a union value from a media query list.
GetHashCode()Returns the hash code for this instance.

Equals overloads

Equals(MediaListOrBoolean)

CSSRules.cs

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

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

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

Equals(object?)

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

FromBoolean(bool)

CSSRules.cs

Creates a union value from a boolean.

public static MediaListOrBoolean FromBoolean(bool value)

Parameters

value bool

Returns

MediaListOrBoolean

FromMediaList(MediaList)

CSSRules.cs

Creates a union value from a media query list.

public static MediaListOrBoolean FromMediaList(MediaList value)

Parameters

value MediaList

Returns

MediaListOrBoolean

GetHashCode()

CSSRules.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 ==(MediaListOrBoolean, MediaListOrBoolean)Returns whether the two values hold the same media query list or the same boolean.
implicit operator MediaListOrBoolean(MediaList)Creates a union value from a media query list.
implicit operator MediaListOrBoolean(bool)Creates a union value from a boolean.
operator !=(MediaListOrBoolean, MediaListOrBoolean)Returns whether the two values hold different values.

operator ==(MediaListOrBoolean, MediaListOrBoolean)

CSSRules.cs

Returns whether the two values hold the same media query list or the same boolean.

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

Parameters

left MediaListOrBoolean
right MediaListOrBoolean

Returns

bool

op_Implicit overloads

implicit operator MediaListOrBoolean(MediaList)

CSSRules.cs

Creates a union value from a media query list.

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

MediaListOrBoolean

implicit operator MediaListOrBoolean(bool)

CSSRules.cs

Creates a union value from a boolean.

public static implicit operator MediaListOrBoolean(bool value)
Parameters
value bool
Returns

MediaListOrBoolean

operator !=(MediaListOrBoolean, MediaListOrBoolean)

CSSRules.cs

Returns whether the two values hold different values.

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

Parameters

left MediaListOrBoolean
right MediaListOrBoolean

Returns

bool