public void WriteByType(object _value, Type _type)
            {
                ProtoTypeCode code = PBHelperCSLE.GetTypeCode(_type);

                switch (code)
                {
                case ProtoTypeCode.Int32:
                    WriteInt32((int)_value);
                    break;

                case ProtoTypeCode.UInt32:
                    WriteUInt32((uint)_value);
                    break;

                case ProtoTypeCode.Int64:
                    WriteInt64((long)_value);
                    break;

                case ProtoTypeCode.UInt64:
                    WriteUInt64((ulong)_value);
                    break;

                case ProtoTypeCode.String:
                    WriteString((string)_value);
                    break;

                case ProtoTypeCode.Single:
                    WriteSingle((float)_value);
                    break;

                case ProtoTypeCode.Double:
                    WriteDouble((double)_value);
                    break;

                case ProtoTypeCode.Boolean:
                    WriteBoolean((bool)_value);
                    break;

                case ProtoTypeCode.Char:
                case ProtoTypeCode.Byte:
                    WriteByte((byte)_value);
                    break;

                case ProtoTypeCode.SByte:
                    WriteSByte((sbyte)_value);
                    break;

                case ProtoTypeCode.Int16:
                    WriteInt16((short)_value);
                    break;

                case ProtoTypeCode.UInt16:
                    WriteUInt16((ushort)_value);
                    break;

                case ProtoTypeCode.Guid:
                case ProtoTypeCode.Uri:
                case ProtoTypeCode.ByteArray:
                case ProtoTypeCode.Type:
                case ProtoTypeCode.TimeSpan:
                case ProtoTypeCode.Decimal:
                case ProtoTypeCode.DateTime:
                    WriteString((string)_value.ToString());
                    break;
                }
            }
            public object ReadByData(Type _type, WireType _wt)
            {
                ProtoTypeCode code = PBHelperCSLE.GetTypeCode(_type);
                object        ret  = null;

                switch (code)
                {
                case ProtoTypeCode.Int32:
                    ret = ReadInt32(_wt);
                    break;

                case ProtoTypeCode.UInt32:
                    ret = ReadUInt32(_wt);
                    break;

                case ProtoTypeCode.Int64:
                    ret = ReadInt64(_wt);
                    break;

                case ProtoTypeCode.UInt64:
                    ret = ReadUInt64(_wt);
                    break;

                case ProtoTypeCode.Single:
                    ret = ReadSingle(_wt);
                    break;

                case ProtoTypeCode.Double:
                    ret = ReadDouble(_wt);
                    break;

                case ProtoTypeCode.Boolean:
                    ret = ReadBoolean(_wt);
                    break;

                case ProtoTypeCode.Char:
                case ProtoTypeCode.Byte:
                    ret = ReadByte(_wt);
                    break;

                case ProtoTypeCode.SByte:
                    ret = ReadSByte(_wt);
                    break;

                case ProtoTypeCode.Int16:
                    ret = ReadInt16(_wt);
                    break;

                case ProtoTypeCode.UInt16:
                    ret = ReadUInt16(_wt);
                    break;

                case ProtoTypeCode.Guid:
                case ProtoTypeCode.Uri:
                case ProtoTypeCode.ByteArray:
                case ProtoTypeCode.Type:
                case ProtoTypeCode.TimeSpan:
                case ProtoTypeCode.Decimal:
                case ProtoTypeCode.DateTime:
                case ProtoTypeCode.String:
                    ret = ReadString(_wt);
                    break;
                }
                return(ret);
            }