static Guid ReadGuid(PainlessBinaryReader reader)
        {
            const int GuidByteArrayLength = 16;

            byte[] byteArray    = new byte[GuidByteArrayLength];
            int    numBytesRead = reader.Read(byteArray, 0, GuidByteArrayLength);

            if (numBytesRead != GuidByteArrayLength)
            {
                throw new InvalidDataException("Could not read the 16 bytes required for a Guid.");
            }

            return(new Guid(byteArray));
        }
        static DateTime ReadDateTime(PainlessBinaryReader reader)
        {
            long binary = reader.ReadInt64();

            return(System.DateTime.FromBinary(binary));
        }
        static Uri ReadUri(PainlessBinaryReader reader)
        {
            string value = reader.ReadString();

            return(new Uri(value));
        }
        static DateTimeOffset ReadDateTimeOffset(PainlessBinaryReader reader)
        {
            string value = reader.ReadString();

            return(System.DateTimeOffset.Parse(value));
        }
        static TimeSpan ReadTimeSpan(PainlessBinaryReader reader)
        {
            long ticks = reader.ReadInt64();

            return(System.TimeSpan.FromTicks(ticks));
        }