C# Class as one Value in Class // Mimic int behaviour
问题 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