Is there a way to make my new Class mimic the behavior of an int or any Valuetype?
I want something, so these assignments are valid
MyClass myClass = 1;
int i = myClass;
var x = myClass; // And here is important that x is of type int!
The MyClass looks roughly like this
public class MyClass {
public int Value{get;set;}
public int AnotherValue{get;set;}
public T GetSomething<T>() {..}
}
Every assignment of MyClass should return the Variable Value as Type int.
So far i found implicit operator int and implicit operator MyClass (int value). But this is not 'good enough'.
I want that MyClass realy behaves like an int. So var i = myClass lets i be an int.
Is this even possible?