2 // System.Data.SqlTypes.SqlByte
5 // Tim Coleman <tim@timcoleman.com>
7 // (C) Copyright 2002 Tim Coleman
12 namespace System.Data.SqlTypes
14 public struct SqlByte : INullable, IComparable
19 public static readonly SqlByte MaxValue = new SqlByte (0xff);
20 public static readonly SqlByte MinValue = new SqlByte (0);
21 public static readonly SqlByte Null;
22 public static readonly SqlByte Zero = new SqlByte (0);
28 public SqlByte (byte value)
38 get { return (bool) (this == Null); }
44 throw new SqlNullValueException ("The property contains Null.");
54 public static SqlByte Add (SqlByte x, SqlByte y)
59 public static SqlByte BitwiseAnd (SqlByte x, SqlByte y)
64 public static SqlByte BitwiseOr (SqlByte x, SqlByte y)
70 public int CompareTo (object value)
72 throw new NotImplementedException ();
75 public static SqlByte Divide (SqlByte x, SqlByte y)
81 public override bool Equals (object value)
83 throw new NotImplementedException ();
86 public static SqlBoolean Equals (SqlByte x, SqlByte y)
91 public override int GetHashCode ()
96 public static SqlBoolean GreaterThan (SqlByte x, SqlByte y)
101 public static SqlBoolean GreaterThanOrEqual (SqlByte x, SqlByte y)
106 public static SqlBoolean LessThan (SqlByte x, SqlByte y)
111 public static SqlBoolean LessThanOrEqual (SqlByte x, SqlByte y)
116 public static SqlByte Mod (SqlByte x, SqlByte y)
121 public static SqlByte Multiply (SqlByte x, SqlByte y)
126 public static SqlBoolean NotEquals (SqlByte x, SqlByte y)
131 public static SqlByte OnesComplement (SqlByte x)
137 public static SqlByte Parse (string s)
139 throw new NotImplementedException ();
142 public static SqlByte Subtract (SqlByte x, SqlByte y)
147 public SqlBoolean ToSqlBoolean ()
149 return ((SqlBoolean)this);
152 public SqlDecimal ToSqlDecimal ()
154 return ((SqlDecimal)this);
157 public SqlDouble ToSqlDouble ()
159 return ((SqlDouble)this);
162 public SqlInt16 ToSqlInt16 ()
164 return ((SqlInt16)this);
167 public SqlInt32 ToSqlInt32 ()
169 return ((SqlInt32)this);
172 public SqlInt64 ToSqlInt64 ()
174 return ((SqlInt64)this);
177 public SqlMoney ToSqlMoney ()
179 return ((SqlMoney)this);
182 public SqlSingle ToSqlSingle ()
184 return ((SqlSingle)this);
188 public SqlString ToSqlString ()
190 throw new NotImplementedException ();
194 public override string ToString ()
196 throw new NotImplementedException ();
199 public static SqlByte Xor (SqlByte x, SqlByte y)
204 public static SqlByte operator + (SqlByte x, SqlByte y)
206 return new SqlByte ((byte) (x.Value + y.Value));
209 public static SqlByte operator & (SqlByte x, SqlByte y)
211 return new SqlByte ((byte) (x.Value & y.Value));
214 public static SqlByte operator | (SqlByte x, SqlByte y)
216 return new SqlByte ((byte) (x.Value | y.Value));
219 public static SqlByte operator / (SqlByte x, SqlByte y)
221 return new SqlByte ((byte) (x.Value / y.Value));
224 public static SqlBoolean operator == (SqlByte x, SqlByte y)
226 if (x.IsNull || y.IsNull)
227 return SqlBoolean.Null;
229 return new SqlBoolean (x.Value == y.Value);
232 public static SqlByte operator ^ (SqlByte x, SqlByte y)
234 return new SqlByte ((byte) (x.Value ^ y.Value));
237 public static SqlBoolean operator > (SqlByte x, SqlByte y)
239 if (x.IsNull || y.IsNull)
240 return SqlBoolean.Null;
242 return new SqlBoolean (x.Value > y.Value);
245 public static SqlBoolean operator >= (SqlByte x, SqlByte y)
247 if (x.IsNull || y.IsNull)
248 return SqlBoolean.Null;
250 return new SqlBoolean (x.Value >= y.Value);
253 public static SqlBoolean operator != (SqlByte x, SqlByte y)
255 if (x.IsNull || y.IsNull)
256 return SqlBoolean.Null;
258 return new SqlBoolean (!(x.Value == y.Value));
261 public static SqlBoolean operator < (SqlByte x, SqlByte y)
263 if (x.IsNull || y.IsNull)
264 return SqlBoolean.Null;
266 return new SqlBoolean (x.Value < y.Value);
269 public static SqlBoolean operator <= (SqlByte x, SqlByte y)
271 if (x.IsNull || y.IsNull)
272 return SqlBoolean.Null;
274 return new SqlBoolean (x.Value <= y.Value);
277 public static SqlByte operator % (SqlByte x, SqlByte y)
279 return new SqlByte ((byte) (x.Value % y.Value));
282 public static SqlByte operator * (SqlByte x, SqlByte y)
284 return new SqlByte ((byte) (x.Value * y.Value));
287 public static SqlByte operator ~ (SqlByte x)
289 return new SqlByte ((byte) ~x.Value);
292 public static SqlByte operator - (SqlByte x, SqlByte y)
294 return new SqlByte ((byte) (x.Value - y.Value));
297 public static explicit operator SqlByte (SqlBoolean x)
302 return new SqlByte (x.ByteValue);
305 public static explicit operator byte (SqlByte x)
310 public static explicit operator SqlByte (SqlDecimal x)
315 return new SqlByte ((byte)x.Value);
318 public static explicit operator SqlByte (SqlDouble x)
323 return new SqlByte ((byte)x.Value);
326 public static explicit operator SqlByte (SqlInt16 x)
331 return new SqlByte ((byte)x.Value);
334 public static explicit operator SqlByte (SqlInt32 x)
339 return new SqlByte ((byte)x.Value);
342 public static explicit operator SqlByte (SqlInt64 x)
347 return new SqlByte ((byte)x.Value);
350 public static explicit operator SqlByte (SqlMoney x)
355 return new SqlByte ((byte)x.Value);
358 public static explicit operator SqlByte (SqlSingle x)
363 return new SqlByte ((byte)x.Value);
367 public static explicit operator SqlByte (SqlString x)
369 throw new NotImplementedException ();
372 public static implicit operator SqlByte (byte x)
374 return new SqlByte (x);