PDA

Click to See Complete Forum and Search --> : Defining new data-types


vbzero
Aug 2nd, 2002, 06:18 PM
public class UInt1024
{
uint value;

private UInt1024(uint value)
{
//
// TODO: Add constructor logic here
//
if(value < MinValue | value > MaxValue) throw new ArgumentException();
this.value = value;
}

public static implicit operator UInt1024(uint x)
{
return new UInt1024(x);
}

public static implicit operator uint(UInt1024 x)
{
return x.value;
}
}

This defines a new data-type UInt1024. At this moment this
only works like as an usual uint32 data-type.

The value is always given as an uint and so the UInt1024
result will also be equal to an uint.

I now want to give the UInt1024 type a 1024-bit register
to manage numbers. So the values have to be in another
format too.

Any ideas to this problem?

thx!