In This Article

Angle Struct

Represents an angle value, expressed in degrees or radians.

[TypeConverter(typeof(AngleTypeConverter))]
public readonly struct Angle : IEquatable<Angle>
Implements:
IEquatable<Angle>

Properties

Degrees

The angle value, expressed in degrees.

public double Degrees { get; init; }

Property Value

double

Radians

The angle value, expressed in degrees.

public double Radians { get; }

Property Value

double

Methods

Equals(Angle)

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

public bool Equals(Angle other)
Parameter Type Description
other Angle

An object to compare with this object.

Returns

bool:

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

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)
Parameter Type Description
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.

FromDegrees(double)

Creates a Angle instance from the specified angle value, expressed in degrees.

public static Angle FromDegrees(double degrees)
Parameter Type Description
degrees double

The angle value, expressed in degrees.

Returns

Angle:

The Angle that was created.

FromRadians(double)

Creates a Angle instance from the specified angle value, expressed in radians.

public static Angle FromRadians(double radians)
Parameter Type Description
radians double

The angle value, expressed in radians.

Returns

Angle:

The Angle that was created.

GetHashCode()

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.

Normalize()

Normalizes the angle, creating a new instance when normalization is necessary.

public Angle Normalize()

Returns

Angle:

The normalized angle.

Remarks

Angle values higher than 360.0 degrees will wrap back to zero (e.g. 540.0 becomes 180.0). A negative degree angle will be translated to its positive equivalent (e.g. -90.0 becomes 270.0).

ToString()

Returns the string representation of this object.

public override string ToString()

Returns

string:

The string representation of this object.

Operators

operator ==(Angle, Angle)

Compares two objects for equality.

public static bool operator ==(Angle left, Angle right)
Parameter Type Description
left Angle

The first object to compare.

right Angle

The second object to compare.

Returns

bool:

true if the two objects are equal; otherwise, false.

operator !=(Angle, Angle)

Compares two objects for inequality.

public static bool operator !=(Angle left, Angle right)
Parameter Type Description
left Angle

The first object to compare.

right Angle

The second object to compare.

Returns

bool:

true if the two objects are not equal; otherwise, false.

Inherited Members

Extension Methods