I am working on a dll that contains a type that shoul can represent an integer value from 32 to 126 and is called "PByte" (for a byte to print). The problem is that I want to protect the user from type initialization, for example. 1000. This should not cause an exception. It should prevent compilation, for example, Visiual Studio tries to initialize, for example, a byte with 256. The type is initialized in the constructor.
public PByte(int value) { this._value = value; }
it
PByte pb = new PByte(2000);
cannot be compiled.
source share