CornerRadii Struct

The radius of each corner of a rounded rectangle. A corner whose radius is zero is not rounded.

public readonly struct CornerRadii : IEquatable<CornerRadii>

Remarks

The corners are quarters of a circle. Radii that do not fit are reduced as CSS reduces the radii of a border: when the radii of two corners of a side add up to more than that side, every radius is multiplied by the same factor, the largest one that makes them all fit.

Implements

Constructors

NameDescription
CornerRadii(double)Initializes a new instance of the CornerRadii struct whose corners have the same radius.
CornerRadii(double, double, double, double)Initializes a new instance of the CornerRadii struct.

CornerRadii overloads

CornerRadii(double)

CornerRadii.cs

Initializes a new instance of the CornerRadii struct whose corners have the same radius.

public CornerRadii(double radius)
Parameters
radius double
The radius of every corner. Must be zero or positive.
Exceptions
ArgumentException
radius is not a finite number.
ArgumentOutOfRangeException
radius is negative or exceeds 16777216.

CornerRadii(double, double, double, double)

CornerRadii.cs

Initializes a new instance of the CornerRadii struct.

public CornerRadii(double topLeft, double topRight, double bottomRight, double bottomLeft)
Parameters
topLeft double
The radius of the top-left corner. Must be zero or positive.
topRight double
The radius of the top-right corner. Must be zero or positive.
bottomRight double
The radius of the bottom-right corner. Must be zero or positive.
bottomLeft double
The radius of the bottom-left corner. Must be zero or positive.
Exceptions
ArgumentException
A radius is not a finite number.
ArgumentOutOfRangeException
A radius is negative or exceeds 16777216.

Properties

NameDescription
BottomLeftGets the radius of the bottom-left corner.
BottomRightGets the radius of the bottom-right corner.
IsEmptyGets a value indicating whether no corner is rounded.
TopLeftGets the radius of the top-left corner.
TopRightGets the radius of the top-right corner.

BottomLeft

CornerRadii.cs

Gets the radius of the bottom-left corner.

public double BottomLeft { get; }

Property value

double

BottomRight

CornerRadii.cs

Gets the radius of the bottom-right corner.

public double BottomRight { get; }

Property value

double

Gets a value indicating whether no corner is rounded.

public bool IsEmpty { get; }

Property value

bool

Gets the radius of the top-left corner.

public double TopLeft { get; }

Property value

double

Gets the radius of the top-right corner.

public double TopRight { get; }

Property value

double

Methods

NameDescription
Equals(CornerRadii)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.
GetHashCode()Returns the hash code for this instance.
ToString()Returns the radii, clockwise from the top-left corner.

Equals overloads

Equals(CornerRadii)

CornerRadii.cs

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

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

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

Equals(object?)

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

GetHashCode()

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

ToString()

CornerRadii.cs

Returns the radii, clockwise from the top-left corner.

public override string ToString()

Returns

string A culture-invariant string.

Operators

NameDescription
operator ==(CornerRadii, CornerRadii)Determines whether two values have the same radii.
operator !=(CornerRadii, CornerRadii)Determines whether two values have different radii.

operator ==(CornerRadii, CornerRadii)

CornerRadii.cs

Determines whether two values have the same radii.

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

Parameters

left CornerRadii
The first value.
right CornerRadii
The second value.

Returns

bool true if the radii are equal.

operator !=(CornerRadii, CornerRadii)

CornerRadii.cs

Determines whether two values have different radii.

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

Parameters

left CornerRadii
The first value.
right CornerRadii
The second value.

Returns

bool true if a radius differs.