public bool WritePrimitive(Object val) { if (val == null) { daos.WriteByte(NULL); return(true); } else if (val is String) { WriteStr((String)val); return(true); } else if (val is int) { WriteInt((int)val); return(true); } else if (val is long) { WriteLong((long)val); return(true); } else if (val is float) { WriteFloat((float)val); return(true); } else if (val is double) { daos.WriteByte(DOUBLE); daos.WriteDouble((double)val); return(true); } else if (val is byte) { daos.WriteByte(BYTE); daos.WriteByte((byte)val); return(true); } else if (val is short) { daos.WriteByte(SHORT); daos.WriteShort((short)val); return(true); } else if (val is DateTime) { daos.WriteByte(DATE); daos.WriteLong(((DateTime)val).ConvertToLong()); return(true); } else if (val is Boolean) { if ((Boolean)val) { daos.WriteByte(BOOL_TRUE); } else { daos.WriteByte(BOOL_FALSE); } return(true); } else if (val is byte[]) { WriteByteArray((byte[])val, 0, ((byte[])val).Length); return(true); } else if (val is byte[]) { byte[] buf = (byte[])val; WriteByteArray(buf, 0, buf.Length); return(true); } else if (val == END_OBJ) { WriteTag(END); return(true); } return(false); }