private static void OutputResult(SampleDataForResult result) { if (result?.Nested == null) { Console.WriteLine("no result"); return; } foreach (SampleDataForNesting nested in result.Nested) { Console.WriteLine(" ------ Training Program Group Names :"); if (nested.TrainingProgramGroupNames != null) { foreach (string tpgn in nested.TrainingProgramGroupNames) { Console.WriteLine(tpgn); } } Console.WriteLine(" ------ Training Program Names :"); if (nested.TrainingProgramGroupNames != null) { foreach (string tpn in nested.TrainingProgramNames) { Console.WriteLine(tpn); } } } }
private static void Process(string input) { // Dữ liệu gửi đi SampleDataForRequest sendData = new SampleDataForRequest { Nested = new SampleDataForNesting[] { new SampleDataForNesting { TrainingProgramGroupNames = new string[] { "some", "thing" }, TrainingProgramNames = new string[] { "some", "thing" } }, new SampleDataForNesting { TrainingProgramGroupNames = new string[] { "some", "other", "thing" }, TrainingProgramNames = new string[] { "some", "other", "thing" } } } }; // request service SampleDataForResult result = null; ServiceHub.Request <SampleDataForRequest, SampleDataForResult>("Sample.TestService", sendData, out result); OutputResult(result); }