Snooping through 3.5 now that its in production I found something I was REALLY hoping to see ... Anyone up for guesses on why Microsoft.Contracts made it into System.Core? :)
Not ONLY this but parts of the framework (oddly the new parts) ACTUALLY USE the contracts!!!
[Serializable, StructLayout(LayoutKind.Sequential), Immutable, ComVisible(false)]
internal struct BigInteger : IFormattable, IEquatable<BigInteger>, IComparable<BigInteger>, IComparable
Yes YES YES !!! IMMUTABLE .... mmm so yummy!
[Pure]
public static bool operator >(BigInteger x, BigInteger y)
{
return (Compare(x, y) > 0);
}
And finally ...
private static ushort Exponent(byte[] doubleBits)
{
Contract.Requires(doubleBits.Length == 8);
return (ushort) ((((ushort) (doubleBits[7] & 0x7f)) << 4) | (((ushort) (doubleBits
& 240)) >> 4));
}
Somebody at Microsoft has really made my DAY!!!
Very soon me thinks ... spec# will be coming to a framework near you!!
Posted
Wed, Nov 21 2007 6:34 PM
by
Greg