<p>Unlike C++, in C# you can't overload the assignment operator. </p>

<p>I'm doing a custom Number class for arithmetic operations with very large numbers and I want it to have the look-and-feel of the built-in numerical types like int, decimal, etc. I've overloaded the arithmetic operators, but the assignment remains...</p>

<p>Here's an example:</p>

<pre><code>Number a = new Number(55); 
Number b = a; //I want to copy the value, not the reference
</code></pre>

<p>Is there a workaround for that issue?</p>

You won't be able to work around it having the C++ look, since a = b; has other semantics in C++ than in C#. In C#, a = b; makes a point to the same object like b. In C++, a = b changes the content of a. Both has their ups and downs. It's like you do
```
```
MyType * a = new MyType();
MyType * b = new MyType(); 
a = b; /* only exchange pointers. will not change any content */
```
```
In C++ (it will lose the reference to the first object, and create a memory leak. But let's ignore that here). You cannot overload the assign operator in C++ for that either.
The workaround is easy:
```
```
MyType a = new MyType();
MyType b = new MyType();

// instead of a = b
a.Assign(b);
```
```
Disclaimer
: I'm not a C# developer
You could create a write-only-property like this. then do a.Self = b; above.
```
```
public MyType Self {
    set {
        /* copy content of value to this */
        this.Assign(value);
    }
}
```
```
Now, this is
not
good. Since it violates the principle-of-least-surprise (POLS). One wouldn't expect a to change if one does a.Self = b;