Database boolean type
The DBBool struct below implements a three-valued logical type. The possible values of this type are DBBool.True, DBBool.False, and DBBool.Null, where the Null member indicates an unknown value. Such three-valued logical types are commonly used in databases. using System; public struct DBBool public static readonly DBBool Null = new DBBool(0); // Private field that stores –1, 0, 1 for False, Null, True. sbyte value; // Private instance constructor. The value parameter must be –1, 0, or 1. DBBool(int value) { // Properties to examine the value of a DBBool. Return true if this public bool IsNull { get { return value == 0; } } public bool IsFalse { get { return value < 0; } } public bool IsTrue { get { return value > 0; } } // Implicit conversion from bool to DBBool. Maps true to DBBool.True and public static implicit operator DBBool(bool x) { // Explicit conversion from DBBool to bool. Throws an exception if the public static explicit operator bool(DBBool x) { // Equality operator. Returns Null if either operand is Null, otherwise public static DBBool operator ==(DBBool x, DBBool y) { // Inequality operator. Returns Null if either operand is Null, otherwise public static DBBool operator!=(DBBool x, DBBool y) { // Logical negation operator. Returns True if the operand is False, Null public static DBBool operator!(DBBool x) { // Logical AND operator. Returns False if either operand is False, public static DBBool operator &(DBBool x, DBBool y) { // Logical OR operator. Returns True if either operand is True, otherwise public static DBBool operator |(DBBool x, DBBool y) { // Definitely true operator. Returns true if the operand is True, false public static bool operator true(DBBool x) { // Definitely false operator. Returns true if the operand is False, false public static bool operator false(DBBool x) { public override bool Equals(object obj) { public override int GetHashCode() { public override string ToString() { Arrays An array is a data structure that contains a number of variables which are accessed through computed indices. The variables contained in an array, also called the elements of the array, are all of the same type, and this type is called the element type of the array. An array has a rank which determines the number of indices associated with each array element. The rank of an array is also referred to as the dimensions of the array. An array with a rank of one is called a single-dimensional array. An array with a rank greater than one is called a multi-dimensional array. Specific sized multi-dimensional arrays are often referred to as two-dimensional arrays, three-dimensional arrays, and so on. Each dimension of an array has an associated length which is an integral number greater than or equal to zero. The dimension lengths are not part of the type of the array, but rather are established when an instance of the array type is created at run-time. The length of a dimension determines the valid range of indices for that dimension: For a dimension of length N, indices can range from 0 to N – 1 inclusive. The total number of elements in an array is the product of the lengths of each dimension in the array. If one or more of the dimensions of an array have a length of zero, the array is said to be empty. The element type of an array can be any type, including an array type.
|