public override byte[] Serialize(bool partofsomethingelse) { int currentIndex = 0, length = 0; bool hasmetacomponents = false; byte[] thischunk, scratch1, scratch2; List <byte[]> pieces = new List <byte[]>(); GCHandle h; //action_goal if (action_goal == null) { action_goal = new Messages.object_recognition_msgs.ObjectRecognitionActionGoal(); } pieces.Add(action_goal.Serialize(true)); //action_result if (action_result == null) { action_result = new Messages.object_recognition_msgs.ObjectRecognitionActionResult(); } pieces.Add(action_result.Serialize(true)); //action_feedback if (action_feedback == null) { action_feedback = new Messages.object_recognition_msgs.ObjectRecognitionActionFeedback(); } pieces.Add(action_feedback.Serialize(true)); //combine every array in pieces into one array and return it int __a_b__f = pieces.Sum((__a_b__c) => __a_b__c.Length); int __a_b__e = 0; byte[] __a_b__d = new byte[__a_b__f]; foreach (var __p__ in pieces) { Array.Copy(__p__, 0, __a_b__d, __a_b__e, __p__.Length); __a_b__e += __p__.Length; } return(__a_b__d); }