Tag Archives: operators

Use == and != to compare structs in C#

This example shows how you can overload the == and != operators to make it easier to compare structs. By default, for reference types (classes), == returns true if two references refer to the same object (reference equality). It returns … Continue reading

Posted in operators, syntax | Tagged , , , , , , , , , , , , , , , | Leave a comment

Refine the complex number class in C#

This example shows how to refine the complex number class defined by the example Make a complex number class that works with real numbers in C#. That example explains how to build a Complex class that represents complex numbers. It … Continue reading

Posted in classes, mathematics, OOP, operators | Tagged , , , , , , , , , , , , , , , | 1 Comment

Make a complex number class that works with real numbers in C#

The example Make a complex number class with overloaded operators in C# builds a simple Complex class that includes overloaded +, -, *, and / operators that let you combine Complex objects. For example, a program can execute the following … Continue reading

Posted in classes, mathematics, OOP, operators | Tagged , , , , , , , , , , , , , , , | 1 Comment

Make a complex number class with equality in C#

The example Make a complex number class with overloaded operators in C# builds a simple Complex class that includes overloaded +, -, *, and / operators that let you combine Complex objects. For example, a program can execute the following … Continue reading

Posted in classes, mathematics, OOP, operators | Tagged , , , , , , , , , , , , , , , | 3 Comments

Make a complex number class with overloaded operators in C#

This example uses a complex number class to demonstrate operator overloading, a technique that allows you to define operators such as + and * for objects. Many people use a complex number class as an example because the operators are … Continue reading

Posted in classes, mathematics, OOP, operators | Tagged , , , , , , , , , , , | 3 Comments

Use set operators in C#

This example shows how you can add set operators to make working with sets slightly easier. The example Perform set operations in C# explains how to use the HashSet class to represent and manipulate sets. Unfortunately to manipulate the sets … Continue reading

Posted in algorithms, classes, mathematics | Tagged , , , , , , , , , , , , , , , , | Leave a comment