Skip to the content.

< Back


MyOperators

Namespace: MyClassLib

A class exercising operator overloads.

public class MyOperators

Inheritance ObjectMyOperators
Attributes NullableContextAttribute, NullableAttribute

Properties

Value

The wrapped value.

public int Value { get; }

Property Value

Int32

Constructors

MyOperators(Int32)

Initializes a new MyOperators.

public MyOperators(int value)

Parameters

value Int32
The wrapped value.

Methods

Equals(Object)

public override bool Equals(object? obj)

Parameters

obj Object?

Returns

Boolean

GetHashCode()

public override int GetHashCode()

Returns

Int32

Operators

operator +(MyOperators, MyOperators)

Adds two operands.

public static MyOperators operator +(MyOperators a, MyOperators b)

Parameters

a MyOperators
The left operand.

b MyOperators
The right operand.

Returns

MyOperators
The sum.

operator -(MyOperators, MyOperators)

Subtracts two operands.

public static MyOperators operator -(MyOperators a, MyOperators b)

Parameters

a MyOperators
The left operand.

b MyOperators
The right operand.

Returns

MyOperators
The difference.

operator ==(MyOperators, MyOperators)

Equality.

public static bool operator ==(MyOperators a, MyOperators b)

Parameters

a MyOperators
The left operand.

b MyOperators
The right operand.

Returns

Boolean
True when values are equal.

operator !=(MyOperators, MyOperators)

Inequality.

public static bool operator !=(MyOperators a, MyOperators b)

Parameters

a MyOperators
The left operand.

b MyOperators
The right operand.

Returns

Boolean
True when values are not equal.

implicit operator int(MyOperators)

Implicit conversion to Int32.

public static implicit operator int(MyOperators value)

Parameters

value MyOperators
The value to convert.

Returns

Int32

explicit operator MyOperators(Int32)

Explicit conversion from Int32.

public static explicit operator MyOperators(int value)

Parameters

value Int32
The value to convert.

Returns

MyOperators


< Back