Esempio n. 1
0
        public void CustomTypeConversions()
        {
            // In terms of the intrinsic numerical types (sbyte, int, float, etc.), an explicit conversion is required when
            //you attempt to store a larger value in a smaller container, as this could result in a loss of data. Conversely, an
            //implicit conversion happens automatically when you attempt to place a smaller type in a destination type that will not result in a loss of data:
            int  a = 123;
            long b = a;      // implicit
            int  c = (int)b; // explicit

            // C# provides two keywords,explicit and implicit, that you can use to control how your types respond during an attempted conversion.
            Point p = new Point()
            {
                X = 2, Y = 1
            };
            PointSpace ps = p;
            Point      p2 = (Point)ps;
            // conversion routines make use of the C# operator keyword, in conjunction with the explicit or implicit keyword, and must be defined as static. The incoming parameter is the
            // entity you are converting from, while the operator type is the entity you are converting to.

            PointSpace ps2 = 1;
            int        i   = (int)ps2;
            // the incoming operator -> entity converting from, operator type -> converting to;
        }
Esempio n. 2
0
 public static T[,] op_Division(T[,] matrix, T point) => PointSpace.op_Division(matrix, point);
Esempio n. 3
0
 public static T[,] op_Concatenate(T[,] matrix, T point) => PointSpace.op_Concatenate(matrix, point);
Esempio n. 4
0
 public static T[,] op_Multiply(T[,] matrix, T point) => PointSpace.op_Multiply(matrix, point);
Esempio n. 5
0
 public static T[,] op_Subtraction(T[,] matrix, T point) => PointSpace.op_Subtraction(matrix, point);
Esempio n. 6
0
 public static T[,] op_Addition(T[,] matrix, T point) => PointSpace.op_Addition(matrix, point);
Esempio n. 7
0
 public static T[,] op_BitwiseOr(T[,] matrix, T point) => PointSpace.op_BitwiseOr(matrix, point);
Esempio n. 8
0
 public static T[,] op_BitwiseAnd <T>(this T[,] matrix, T point) => PointSpace.op_BitwiseAnd(matrix, point);