# Specify Variable Size

Is there an easy way to specify the variable size and still use them as variables more specifically for the .NETLink?

Something like the following I am thinking.

t = Int[2];

and then the variable could only be set to unsigned int values as an example.

Anoter example I want i = unsignedChar[3] to be exactly 0 to 255 when you assign values to it. So i = 156 would either throw an error or overflow.

t /: Set[t, whatever : Except[_Integer]] := $Failed ] You can use whatever patter you wish. t = 2; t 2 t = "test"$Failed