While i know that the bytes are cheap today,
i still prefer to use a byte (or short) when
i know that the entity counted isn't larger
than 255 (or 65k). However, it's a real pain
to cast every time i perform an operation.
Example:
private byte a, b;
public byte MyProperty
{ get { return (byte)(a + b); } }
How can i avoid doing that? I'd like to
redeclare/overload the arithmetical
operators so they return a byte (or short)
when computing two bytes (or shorts).
Is it easily doable? Is it doable?
--
Regards
Konrad Viltersten
--------------------------------
sleep - a substitute for coffee for the poor
ambition - lack of sense to be lazy
i still prefer to use a byte (or short) when
i know that the entity counted isn't larger
than 255 (or 65k). However, it's a real pain
to cast every time i perform an operation.
Example:
private byte a, b;
public byte MyProperty
{ get { return (byte)(a + b); } }
How can i avoid doing that? I'd like to
redeclare/overload the arithmetical
operators so they return a byte (or short)
when computing two bytes (or shorts).
Is it easily doable? Is it doable?
--
Regards
Konrad Viltersten
--------------------------------
sleep - a substitute for coffee for the poor
ambition - lack of sense to be lazy
Comment