List <byte> IConcreteAction.Serialize(object dataObject)
        {
            IPrimitive primitive = PrimitiveFactory.MakePrimitive(type);

            byte[] representBytes = primitive.GetByteStream(dataObject);
            return(representBytes.ToList());
        }
        List <byte> IConcreteAction.Serialize(object dataObject)
        {
            var resultStream = new List <byte>();

            string     str           = (string)dataObject;
            IPrimitive rankPrimitive = PrimitiveFactory.MakePrimitive(typeof(ushort));

            byte[] rank = rankPrimitive.GetByteStream((ushort)str.Length);
            resultStream.AddRange(rank);

            byte[] data = Encoding.Unicode.GetBytes(str);
            resultStream.AddRange(data);

            return(resultStream);
        }
        private int[] RecordAndExtractDimensional()
        {
            IPrimitive rankPrimitive = PrimitiveFactory.MakePrimitive(typeof(byte));

            byte[] rank = rankPrimitive.GetByteStream((byte)array.Rank);
            resultStream.AddRange(rank);

            IPrimitive lengthPrimitive = PrimitiveFactory.MakePrimitive(typeof(ushort));

            int[] lengths = new int[array.Rank];
            for (int dimension = 0; dimension < array.Rank; dimension++)
            {
                lengths[dimension] = array.GetLength(dimension);

                byte[] bytesToWrite = lengthPrimitive.GetByteStream((ushort)lengths[dimension]);
                resultStream.AddRange(bytesToWrite);
            }
            return(lengths);
        }