Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / Data / System / Data / SQLTypes / SQLByte.cs / 1 / SQLByte.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //junfang //[....] //[....] //----------------------------------------------------------------------------- //************************************************************************* // @File: SqlByte.cs // // Create by: JunFang // // Purpose: Implementation of SqlByte which is equivalent to // data type "smallint" in SQL Server // // Notes: // // History: // // 11/1/99 JunFang Created. // // @EndHeader@ //************************************************************************* using System; using System.Data.Common; using System.Runtime.InteropServices; using System.Globalization; using System.Xml; using System.Xml.Schema; using System.Xml.Serialization; namespace System.Data.SqlTypes { ////// [Serializable] [StructLayout(LayoutKind.Sequential)] [XmlSchemaProvider("GetXsdType")] public struct SqlByte : INullable, IComparable, IXmlSerializable { private bool m_fNotNull; // false if null private byte m_value; private static readonly int x_iBitNotByteMax = ~0xff; // constructor // construct a Null private SqlByte(bool fNull) { m_fNotNull = false; m_value = 0; } ////// Represents an 8-bit unsigned integer to be stored in /// or retrieved from a database. /// ////// public SqlByte(byte value) { m_value = value; m_fNotNull = true; } // INullable ///[To be supplied.] ////// public bool IsNull { get { return !m_fNotNull;} } // property: Value ///[To be supplied.] ////// public byte Value { get { if (m_fNotNull) return m_value; else throw new SqlNullValueException(); } } // Implicit conversion from byte to SqlByte ///[To be supplied.] ////// public static implicit operator SqlByte(byte x) { return new SqlByte(x); } // Explicit conversion from SqlByte to byte. Throw exception if x is Null. ///[To be supplied.] ////// public static explicit operator byte(SqlByte x) { return x.Value; } ///[To be supplied.] ////// public override String ToString() { return IsNull ? SQLResource.NullString : m_value.ToString((IFormatProvider)null); } ///[To be supplied.] ////// public static SqlByte Parse(String s) { if (s == SQLResource.NullString) return SqlByte.Null; else return new SqlByte(Byte.Parse(s, (IFormatProvider)null)); } // Unary operators ///[To be supplied.] ////// public static SqlByte operator ~(SqlByte x) { return x.IsNull ? Null : new SqlByte((byte)~x.m_value); } // Binary operators // Arithmetic operators ///[To be supplied.] ////// public static SqlByte operator +(SqlByte x, SqlByte y) { if (x.IsNull || y.IsNull) return Null; int iResult = (int)x.m_value + (int)y.m_value; if ((iResult & x_iBitNotByteMax) != 0) throw new OverflowException(SQLResource.ArithOverflowMessage); else return new SqlByte((byte)iResult); } ///[To be supplied.] ////// public static SqlByte operator -(SqlByte x, SqlByte y) { if (x.IsNull || y.IsNull) return Null; int iResult = (int)x.m_value - (int)y.m_value; if ((iResult & x_iBitNotByteMax) != 0) throw new OverflowException(SQLResource.ArithOverflowMessage); else return new SqlByte((byte)iResult); } ///[To be supplied.] ////// public static SqlByte operator *(SqlByte x, SqlByte y) { if (x.IsNull || y.IsNull) return Null; int iResult = (int)x.m_value * (int)y.m_value; if ((iResult & x_iBitNotByteMax) != 0) throw new OverflowException(SQLResource.ArithOverflowMessage); else return new SqlByte((byte)iResult); } ///[To be supplied.] ////// public static SqlByte operator /(SqlByte x, SqlByte y) { if (x.IsNull || y.IsNull) return Null; if (y.m_value != 0) { return new SqlByte((byte)(x.m_value / y.m_value)); } else throw new DivideByZeroException(SQLResource.DivideByZeroMessage); } ///[To be supplied.] ////// public static SqlByte operator %(SqlByte x, SqlByte y) { if (x.IsNull || y.IsNull) return Null; if (y.m_value != 0) { return new SqlByte((byte)(x.m_value % y.m_value)); } else throw new DivideByZeroException(SQLResource.DivideByZeroMessage); } // Bitwise operators ///[To be supplied.] ////// public static SqlByte operator &(SqlByte x, SqlByte y) { return(x.IsNull || y.IsNull) ? Null : new SqlByte((byte)(x.m_value & y.m_value)); } ///[To be supplied.] ////// public static SqlByte operator |(SqlByte x, SqlByte y) { return(x.IsNull || y.IsNull) ? Null : new SqlByte((byte)(x.m_value | y.m_value)); } ///[To be supplied.] ////// public static SqlByte operator ^(SqlByte x, SqlByte y) { return(x.IsNull || y.IsNull) ? Null : new SqlByte((byte)(x.m_value ^ y.m_value)); } // Implicit conversions // Implicit conversion from SqlBoolean to SqlByte ///[To be supplied.] ////// public static explicit operator SqlByte(SqlBoolean x) { return x.IsNull ? Null : new SqlByte((byte)(x.ByteValue)); } // Explicit conversions // Explicit conversion from SqlMoney to SqlByte ///[To be supplied.] ////// public static explicit operator SqlByte(SqlMoney x) { return x.IsNull ? Null : new SqlByte(checked((byte)x.ToInt32())); } // Explicit conversion from SqlInt16 to SqlByte ///[To be supplied.] ////// public static explicit operator SqlByte(SqlInt16 x) { if (x.IsNull) return Null; if (x.Value > (short)Byte.MaxValue || x.Value < (short)Byte.MinValue) throw new OverflowException(SQLResource.ArithOverflowMessage); return x.IsNull ? Null : new SqlByte((byte)(x.Value)); } // Explicit conversion from SqlInt32 to SqlByte ///[To be supplied.] ////// public static explicit operator SqlByte(SqlInt32 x) { if (x.IsNull) return Null; if (x.Value > (int)Byte.MaxValue || x.Value < (int)Byte.MinValue) throw new OverflowException(SQLResource.ArithOverflowMessage); return x.IsNull ? Null : new SqlByte((byte)(x.Value)); } // Explicit conversion from SqlInt64 to SqlByte ///[To be supplied.] ////// public static explicit operator SqlByte(SqlInt64 x) { if (x.IsNull) return Null; if (x.Value > (long)Byte.MaxValue || x.Value < (long)Byte.MinValue) throw new OverflowException(SQLResource.ArithOverflowMessage); return x.IsNull ? Null : new SqlByte((byte)(x.Value)); } // Explicit conversion from SqlSingle to SqlByte ///[To be supplied.] ////// public static explicit operator SqlByte(SqlSingle x) { if (x.IsNull) return Null; if (x.Value > (float)Byte.MaxValue || x.Value < (float)Byte.MinValue) throw new OverflowException(SQLResource.ArithOverflowMessage); return x.IsNull ? Null : new SqlByte((byte)(x.Value)); } // Explicit conversion from SqlDouble to SqlByte ///[To be supplied.] ////// public static explicit operator SqlByte(SqlDouble x) { if (x.IsNull) return Null; if (x.Value > (double)Byte.MaxValue || x.Value < (double)Byte.MinValue) throw new OverflowException(SQLResource.ArithOverflowMessage); return x.IsNull ? Null : new SqlByte((byte)(x.Value)); } // Explicit conversion from SqlDecimal to SqlByte ///[To be supplied.] ////// public static explicit operator SqlByte(SqlDecimal x) { return(SqlByte)(SqlInt32)x; } // Implicit conversion from SqlString to SqlByte // Throws FormatException or OverflowException if necessary. ///[To be supplied.] ////// public static explicit operator SqlByte(SqlString x) { return x.IsNull ? Null : new SqlByte(Byte.Parse(x.Value, (IFormatProvider)null)); } // Overloading comparison operators ///[To be supplied.] ////// public static SqlBoolean operator==(SqlByte x, SqlByte y) { return(x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value == y.m_value); } ///[To be supplied.] ////// public static SqlBoolean operator!=(SqlByte x, SqlByte y) { return ! (x == y); } ///[To be supplied.] ////// public static SqlBoolean operator<(SqlByte x, SqlByte y) { return(x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value < y.m_value); } ///[To be supplied.] ////// public static SqlBoolean operator>(SqlByte x, SqlByte y) { return(x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value > y.m_value); } ///[To be supplied.] ////// public static SqlBoolean operator<=(SqlByte x, SqlByte y) { return(x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value <= y.m_value); } ///[To be supplied.] ////// public static SqlBoolean operator>=(SqlByte x, SqlByte y) { return(x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value >= y.m_value); } //-------------------------------------------------- // Alternative methods for overloaded operators //-------------------------------------------------- // Alternative method for operator ~ public static SqlByte OnesComplement(SqlByte x) { return ~x; } // Alternative method for operator + public static SqlByte Add(SqlByte x, SqlByte y) { return x + y; } // Alternative method for operator - public static SqlByte Subtract(SqlByte x, SqlByte y) { return x - y; } // Alternative method for operator * public static SqlByte Multiply(SqlByte x, SqlByte y) { return x * y; } // Alternative method for operator / public static SqlByte Divide(SqlByte x, SqlByte y) { return x / y; } // Alternative method for operator % public static SqlByte Mod(SqlByte x, SqlByte y) { return x % y; } public static SqlByte Modulus(SqlByte x, SqlByte y) { return x % y; } // Alternative method for operator & public static SqlByte BitwiseAnd(SqlByte x, SqlByte y) { return x & y; } // Alternative method for operator | public static SqlByte BitwiseOr(SqlByte x, SqlByte y) { return x | y; } // Alternative method for operator ^ public static SqlByte Xor(SqlByte x, SqlByte y) { return x ^ y; } // Alternative method for operator == public static SqlBoolean Equals(SqlByte x, SqlByte y) { return (x == y); } // Alternative method for operator != public static SqlBoolean NotEquals(SqlByte x, SqlByte y) { return (x != y); } // Alternative method for operator < public static SqlBoolean LessThan(SqlByte x, SqlByte y) { return (x < y); } // Alternative method for operator > public static SqlBoolean GreaterThan(SqlByte x, SqlByte y) { return (x > y); } // Alternative method for operator <= public static SqlBoolean LessThanOrEqual(SqlByte x, SqlByte y) { return (x <= y); } // Alternative method for operator >= public static SqlBoolean GreaterThanOrEqual(SqlByte x, SqlByte y) { return (x >= y); } // Alternative method for conversions. public SqlBoolean ToSqlBoolean() { return (SqlBoolean)this; } public SqlDouble ToSqlDouble() { return (SqlDouble)this; } public SqlInt16 ToSqlInt16() { return (SqlInt16)this; } public SqlInt32 ToSqlInt32() { return (SqlInt32)this; } public SqlInt64 ToSqlInt64() { return (SqlInt64)this; } public SqlMoney ToSqlMoney() { return (SqlMoney)this; } public SqlDecimal ToSqlDecimal() { return (SqlDecimal)this; } public SqlSingle ToSqlSingle() { return (SqlSingle)this; } public SqlString ToSqlString() { return (SqlString)this; } // IComparable // Compares this object to another object, returning an integer that // indicates the relationship. // Returns a value less than zero if this < object, zero if this = object, // or a value greater than zero if this > object. // null is considered to be less than any instance. // If object is not of same type, this method throws an ArgumentException. ///[To be supplied.] ////// public int CompareTo(Object value) { if (value is SqlByte) { SqlByte i = (SqlByte)value; return CompareTo(i); } throw ADP.WrongType(value.GetType(), typeof(SqlByte)); } public int CompareTo(SqlByte value) { // If both Null, consider them equal. // Otherwise, Null is less than anything. if (IsNull) return value.IsNull ? 0 : -1; else if (value.IsNull) return 1; if (this < value) return -1; if (this > value) return 1; return 0; } // Compares this instance with a specified object ///[To be supplied.] ////// public override bool Equals(Object value) { if (!(value is SqlByte)) { return false; } SqlByte i = (SqlByte)value; if (i.IsNull || IsNull) return (i.IsNull && IsNull); else return (this == i).Value; } // For hashing purpose ///[To be supplied.] ////// public override int GetHashCode() { return IsNull ? 0 : Value.GetHashCode(); } ///[To be supplied.] ////// XmlSchema IXmlSerializable.GetSchema() { return null; } ///[To be supplied.] ////// void IXmlSerializable.ReadXml(XmlReader reader) { string isNull = reader.GetAttribute("nil", XmlSchema.InstanceNamespace); if (isNull != null && XmlConvert.ToBoolean(isNull)) { m_fNotNull = false; } else { m_value = XmlConvert.ToByte(reader.ReadElementString()); m_fNotNull = true; } } ///[To be supplied.] ////// void IXmlSerializable.WriteXml(XmlWriter writer) { if (IsNull) { writer.WriteAttributeString("xsi", "nil", XmlSchema.InstanceNamespace, "true"); } else { writer.WriteString(XmlConvert.ToString(m_value)); } } ///[To be supplied.] ////// public static XmlQualifiedName GetXsdType(XmlSchemaSet schemaSet) { return new XmlQualifiedName("unsignedByte", XmlSchema.Namespace); } ///[To be supplied.] ////// public static readonly SqlByte Null = new SqlByte(true); ///[To be supplied.] ////// public static readonly SqlByte Zero = new SqlByte(0); ///[To be supplied.] ////// public static readonly SqlByte MinValue = new SqlByte(Byte.MinValue); ///[To be supplied.] ////// public static readonly SqlByte MaxValue = new SqlByte(Byte.MaxValue); } // SqlByte } // namespace System // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //[To be supplied.] ///// Copyright (c) Microsoft Corporation. All rights reserved. // //junfang //[....] //[....] //----------------------------------------------------------------------------- //************************************************************************* // @File: SqlByte.cs // // Create by: JunFang // // Purpose: Implementation of SqlByte which is equivalent to // data type "smallint" in SQL Server // // Notes: // // History: // // 11/1/99 JunFang Created. // // @EndHeader@ //************************************************************************* using System; using System.Data.Common; using System.Runtime.InteropServices; using System.Globalization; using System.Xml; using System.Xml.Schema; using System.Xml.Serialization; namespace System.Data.SqlTypes { ////// [Serializable] [StructLayout(LayoutKind.Sequential)] [XmlSchemaProvider("GetXsdType")] public struct SqlByte : INullable, IComparable, IXmlSerializable { private bool m_fNotNull; // false if null private byte m_value; private static readonly int x_iBitNotByteMax = ~0xff; // constructor // construct a Null private SqlByte(bool fNull) { m_fNotNull = false; m_value = 0; } ////// Represents an 8-bit unsigned integer to be stored in /// or retrieved from a database. /// ////// public SqlByte(byte value) { m_value = value; m_fNotNull = true; } // INullable ///[To be supplied.] ////// public bool IsNull { get { return !m_fNotNull;} } // property: Value ///[To be supplied.] ////// public byte Value { get { if (m_fNotNull) return m_value; else throw new SqlNullValueException(); } } // Implicit conversion from byte to SqlByte ///[To be supplied.] ////// public static implicit operator SqlByte(byte x) { return new SqlByte(x); } // Explicit conversion from SqlByte to byte. Throw exception if x is Null. ///[To be supplied.] ////// public static explicit operator byte(SqlByte x) { return x.Value; } ///[To be supplied.] ////// public override String ToString() { return IsNull ? SQLResource.NullString : m_value.ToString((IFormatProvider)null); } ///[To be supplied.] ////// public static SqlByte Parse(String s) { if (s == SQLResource.NullString) return SqlByte.Null; else return new SqlByte(Byte.Parse(s, (IFormatProvider)null)); } // Unary operators ///[To be supplied.] ////// public static SqlByte operator ~(SqlByte x) { return x.IsNull ? Null : new SqlByte((byte)~x.m_value); } // Binary operators // Arithmetic operators ///[To be supplied.] ////// public static SqlByte operator +(SqlByte x, SqlByte y) { if (x.IsNull || y.IsNull) return Null; int iResult = (int)x.m_value + (int)y.m_value; if ((iResult & x_iBitNotByteMax) != 0) throw new OverflowException(SQLResource.ArithOverflowMessage); else return new SqlByte((byte)iResult); } ///[To be supplied.] ////// public static SqlByte operator -(SqlByte x, SqlByte y) { if (x.IsNull || y.IsNull) return Null; int iResult = (int)x.m_value - (int)y.m_value; if ((iResult & x_iBitNotByteMax) != 0) throw new OverflowException(SQLResource.ArithOverflowMessage); else return new SqlByte((byte)iResult); } ///[To be supplied.] ////// public static SqlByte operator *(SqlByte x, SqlByte y) { if (x.IsNull || y.IsNull) return Null; int iResult = (int)x.m_value * (int)y.m_value; if ((iResult & x_iBitNotByteMax) != 0) throw new OverflowException(SQLResource.ArithOverflowMessage); else return new SqlByte((byte)iResult); } ///[To be supplied.] ////// public static SqlByte operator /(SqlByte x, SqlByte y) { if (x.IsNull || y.IsNull) return Null; if (y.m_value != 0) { return new SqlByte((byte)(x.m_value / y.m_value)); } else throw new DivideByZeroException(SQLResource.DivideByZeroMessage); } ///[To be supplied.] ////// public static SqlByte operator %(SqlByte x, SqlByte y) { if (x.IsNull || y.IsNull) return Null; if (y.m_value != 0) { return new SqlByte((byte)(x.m_value % y.m_value)); } else throw new DivideByZeroException(SQLResource.DivideByZeroMessage); } // Bitwise operators ///[To be supplied.] ////// public static SqlByte operator &(SqlByte x, SqlByte y) { return(x.IsNull || y.IsNull) ? Null : new SqlByte((byte)(x.m_value & y.m_value)); } ///[To be supplied.] ////// public static SqlByte operator |(SqlByte x, SqlByte y) { return(x.IsNull || y.IsNull) ? Null : new SqlByte((byte)(x.m_value | y.m_value)); } ///[To be supplied.] ////// public static SqlByte operator ^(SqlByte x, SqlByte y) { return(x.IsNull || y.IsNull) ? Null : new SqlByte((byte)(x.m_value ^ y.m_value)); } // Implicit conversions // Implicit conversion from SqlBoolean to SqlByte ///[To be supplied.] ////// public static explicit operator SqlByte(SqlBoolean x) { return x.IsNull ? Null : new SqlByte((byte)(x.ByteValue)); } // Explicit conversions // Explicit conversion from SqlMoney to SqlByte ///[To be supplied.] ////// public static explicit operator SqlByte(SqlMoney x) { return x.IsNull ? Null : new SqlByte(checked((byte)x.ToInt32())); } // Explicit conversion from SqlInt16 to SqlByte ///[To be supplied.] ////// public static explicit operator SqlByte(SqlInt16 x) { if (x.IsNull) return Null; if (x.Value > (short)Byte.MaxValue || x.Value < (short)Byte.MinValue) throw new OverflowException(SQLResource.ArithOverflowMessage); return x.IsNull ? Null : new SqlByte((byte)(x.Value)); } // Explicit conversion from SqlInt32 to SqlByte ///[To be supplied.] ////// public static explicit operator SqlByte(SqlInt32 x) { if (x.IsNull) return Null; if (x.Value > (int)Byte.MaxValue || x.Value < (int)Byte.MinValue) throw new OverflowException(SQLResource.ArithOverflowMessage); return x.IsNull ? Null : new SqlByte((byte)(x.Value)); } // Explicit conversion from SqlInt64 to SqlByte ///[To be supplied.] ////// public static explicit operator SqlByte(SqlInt64 x) { if (x.IsNull) return Null; if (x.Value > (long)Byte.MaxValue || x.Value < (long)Byte.MinValue) throw new OverflowException(SQLResource.ArithOverflowMessage); return x.IsNull ? Null : new SqlByte((byte)(x.Value)); } // Explicit conversion from SqlSingle to SqlByte ///[To be supplied.] ////// public static explicit operator SqlByte(SqlSingle x) { if (x.IsNull) return Null; if (x.Value > (float)Byte.MaxValue || x.Value < (float)Byte.MinValue) throw new OverflowException(SQLResource.ArithOverflowMessage); return x.IsNull ? Null : new SqlByte((byte)(x.Value)); } // Explicit conversion from SqlDouble to SqlByte ///[To be supplied.] ////// public static explicit operator SqlByte(SqlDouble x) { if (x.IsNull) return Null; if (x.Value > (double)Byte.MaxValue || x.Value < (double)Byte.MinValue) throw new OverflowException(SQLResource.ArithOverflowMessage); return x.IsNull ? Null : new SqlByte((byte)(x.Value)); } // Explicit conversion from SqlDecimal to SqlByte ///[To be supplied.] ////// public static explicit operator SqlByte(SqlDecimal x) { return(SqlByte)(SqlInt32)x; } // Implicit conversion from SqlString to SqlByte // Throws FormatException or OverflowException if necessary. ///[To be supplied.] ////// public static explicit operator SqlByte(SqlString x) { return x.IsNull ? Null : new SqlByte(Byte.Parse(x.Value, (IFormatProvider)null)); } // Overloading comparison operators ///[To be supplied.] ////// public static SqlBoolean operator==(SqlByte x, SqlByte y) { return(x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value == y.m_value); } ///[To be supplied.] ////// public static SqlBoolean operator!=(SqlByte x, SqlByte y) { return ! (x == y); } ///[To be supplied.] ////// public static SqlBoolean operator<(SqlByte x, SqlByte y) { return(x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value < y.m_value); } ///[To be supplied.] ////// public static SqlBoolean operator>(SqlByte x, SqlByte y) { return(x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value > y.m_value); } ///[To be supplied.] ////// public static SqlBoolean operator<=(SqlByte x, SqlByte y) { return(x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value <= y.m_value); } ///[To be supplied.] ////// public static SqlBoolean operator>=(SqlByte x, SqlByte y) { return(x.IsNull || y.IsNull) ? SqlBoolean.Null : new SqlBoolean(x.m_value >= y.m_value); } //-------------------------------------------------- // Alternative methods for overloaded operators //-------------------------------------------------- // Alternative method for operator ~ public static SqlByte OnesComplement(SqlByte x) { return ~x; } // Alternative method for operator + public static SqlByte Add(SqlByte x, SqlByte y) { return x + y; } // Alternative method for operator - public static SqlByte Subtract(SqlByte x, SqlByte y) { return x - y; } // Alternative method for operator * public static SqlByte Multiply(SqlByte x, SqlByte y) { return x * y; } // Alternative method for operator / public static SqlByte Divide(SqlByte x, SqlByte y) { return x / y; } // Alternative method for operator % public static SqlByte Mod(SqlByte x, SqlByte y) { return x % y; } public static SqlByte Modulus(SqlByte x, SqlByte y) { return x % y; } // Alternative method for operator & public static SqlByte BitwiseAnd(SqlByte x, SqlByte y) { return x & y; } // Alternative method for operator | public static SqlByte BitwiseOr(SqlByte x, SqlByte y) { return x | y; } // Alternative method for operator ^ public static SqlByte Xor(SqlByte x, SqlByte y) { return x ^ y; } // Alternative method for operator == public static SqlBoolean Equals(SqlByte x, SqlByte y) { return (x == y); } // Alternative method for operator != public static SqlBoolean NotEquals(SqlByte x, SqlByte y) { return (x != y); } // Alternative method for operator < public static SqlBoolean LessThan(SqlByte x, SqlByte y) { return (x < y); } // Alternative method for operator > public static SqlBoolean GreaterThan(SqlByte x, SqlByte y) { return (x > y); } // Alternative method for operator <= public static SqlBoolean LessThanOrEqual(SqlByte x, SqlByte y) { return (x <= y); } // Alternative method for operator >= public static SqlBoolean GreaterThanOrEqual(SqlByte x, SqlByte y) { return (x >= y); } // Alternative method for conversions. public SqlBoolean ToSqlBoolean() { return (SqlBoolean)this; } public SqlDouble ToSqlDouble() { return (SqlDouble)this; } public SqlInt16 ToSqlInt16() { return (SqlInt16)this; } public SqlInt32 ToSqlInt32() { return (SqlInt32)this; } public SqlInt64 ToSqlInt64() { return (SqlInt64)this; } public SqlMoney ToSqlMoney() { return (SqlMoney)this; } public SqlDecimal ToSqlDecimal() { return (SqlDecimal)this; } public SqlSingle ToSqlSingle() { return (SqlSingle)this; } public SqlString ToSqlString() { return (SqlString)this; } // IComparable // Compares this object to another object, returning an integer that // indicates the relationship. // Returns a value less than zero if this < object, zero if this = object, // or a value greater than zero if this > object. // null is considered to be less than any instance. // If object is not of same type, this method throws an ArgumentException. ///[To be supplied.] ////// public int CompareTo(Object value) { if (value is SqlByte) { SqlByte i = (SqlByte)value; return CompareTo(i); } throw ADP.WrongType(value.GetType(), typeof(SqlByte)); } public int CompareTo(SqlByte value) { // If both Null, consider them equal. // Otherwise, Null is less than anything. if (IsNull) return value.IsNull ? 0 : -1; else if (value.IsNull) return 1; if (this < value) return -1; if (this > value) return 1; return 0; } // Compares this instance with a specified object ///[To be supplied.] ////// public override bool Equals(Object value) { if (!(value is SqlByte)) { return false; } SqlByte i = (SqlByte)value; if (i.IsNull || IsNull) return (i.IsNull && IsNull); else return (this == i).Value; } // For hashing purpose ///[To be supplied.] ////// public override int GetHashCode() { return IsNull ? 0 : Value.GetHashCode(); } ///[To be supplied.] ////// XmlSchema IXmlSerializable.GetSchema() { return null; } ///[To be supplied.] ////// void IXmlSerializable.ReadXml(XmlReader reader) { string isNull = reader.GetAttribute("nil", XmlSchema.InstanceNamespace); if (isNull != null && XmlConvert.ToBoolean(isNull)) { m_fNotNull = false; } else { m_value = XmlConvert.ToByte(reader.ReadElementString()); m_fNotNull = true; } } ///[To be supplied.] ////// void IXmlSerializable.WriteXml(XmlWriter writer) { if (IsNull) { writer.WriteAttributeString("xsi", "nil", XmlSchema.InstanceNamespace, "true"); } else { writer.WriteString(XmlConvert.ToString(m_value)); } } ///[To be supplied.] ////// public static XmlQualifiedName GetXsdType(XmlSchemaSet schemaSet) { return new XmlQualifiedName("unsignedByte", XmlSchema.Namespace); } ///[To be supplied.] ////// public static readonly SqlByte Null = new SqlByte(true); ///[To be supplied.] ////// public static readonly SqlByte Zero = new SqlByte(0); ///[To be supplied.] ////// public static readonly SqlByte MinValue = new SqlByte(Byte.MinValue); ///[To be supplied.] ////// public static readonly SqlByte MaxValue = new SqlByte(Byte.MaxValue); } // SqlByte } // namespace System // File provided for Reference Use Only by Microsoft Corporation (c) 2007.[To be supplied.] ///
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Aggregates.cs
- UpWmlPageAdapter.cs
- SequentialOutput.cs
- BitmapMetadata.cs
- BaseCollection.cs
- ImageSourceConverter.cs
- safePerfProviderHandle.cs
- DetailsViewPageEventArgs.cs
- EventLogEntry.cs
- StaticFileHandler.cs
- TCEAdapterGenerator.cs
- EntityDataSourceReferenceGroup.cs
- XmlSchemaIdentityConstraint.cs
- TraceInternal.cs
- GenericNameHandler.cs
- HttpCachePolicyElement.cs
- PointLightBase.cs
- CodeNamespaceCollection.cs
- OutputCacheProviderCollection.cs
- WebPartVerb.cs
- CqlErrorHelper.cs
- SettingsPropertyWrongTypeException.cs
- OdbcHandle.cs
- InvokeMethodActivityDesigner.cs
- EventDescriptorCollection.cs
- InputBinder.cs
- IndexedString.cs
- TypeEnumerableViewSchema.cs
- RowSpanVector.cs
- RoleManagerSection.cs
- SqlUtil.cs
- TypeReference.cs
- SmiRequestExecutor.cs
- glyphs.cs
- Formatter.cs
- HScrollProperties.cs
- ReflectionHelper.cs
- _DomainName.cs
- WaitHandleCannotBeOpenedException.cs
- XPathNavigator.cs
- DownloadProgressEventArgs.cs
- WebPartCloseVerb.cs
- PropertyTabChangedEvent.cs
- ChangeNode.cs
- SelectionPattern.cs
- OSFeature.cs
- AutomationPeer.cs
- SoapAttributes.cs
- XmlSchemaException.cs
- Int64.cs
- XmlSerializerFactory.cs
- FileUtil.cs
- PathStreamGeometryContext.cs
- CollectionBuilder.cs
- DataBindingCollection.cs
- RangeContentEnumerator.cs
- Emitter.cs
- AssociationSetMetadata.cs
- Site.cs
- DbConnectionStringBuilder.cs
- ConsoleCancelEventArgs.cs
- EventBuilder.cs
- TextRange.cs
- TagPrefixCollection.cs
- SecureStringHasher.cs
- BitmapSizeOptions.cs
- StorageEntityTypeMapping.cs
- BinaryNode.cs
- RestClientProxyHandler.cs
- InkCollectionBehavior.cs
- mactripleDES.cs
- X509Certificate.cs
- FileUtil.cs
- _StreamFramer.cs
- ReadOnlyHierarchicalDataSourceView.cs
- StylusLogic.cs
- CounterSample.cs
- DbExpressionRules.cs
- ParamArrayAttribute.cs
- LinqDataSourceDisposeEventArgs.cs
- SolidColorBrush.cs
- ParallelTimeline.cs
- ProjectionPlanCompiler.cs
- Triangle.cs
- ServiceNotStartedException.cs
- Timer.cs
- XhtmlConformanceSection.cs
- DesignerTransactionCloseEvent.cs
- DocumentOrderQuery.cs
- ProviderIncompatibleException.cs
- OleDbCommandBuilder.cs
- SortedSet.cs
- SizeAnimationClockResource.cs
- AuthenticationConfig.cs
- HistoryEventArgs.cs
- MethodBody.cs
- PolyLineSegment.cs
- WebConvert.cs
- DbConnectionClosed.cs
- MouseOverProperty.cs