public override byte[] ToByteArray() { var stream = new MemoryStream(); stream.WriteByte((byte)CommandId); stream.WriteByte(FrameId); var cmd = ((ATAttribute)atCommand.GetAttr()).ATCommand.ToCharArray(); stream.WriteByte((byte)cmd[0]); stream.WriteByte((byte)cmd[1]); if (hasValue) { var v = value.ToByteArray(); stream.Write(v, 0, v.Length); } return(stream.ToArray()); }