public static bool IssNow(out ResponseBodyIssNow responseBody) { using (Stream stream = WebRequests.HttpWebRequest("http://api.open-notify.org/iss-now.json", "GET")) { responseBody = (ResponseBodyIssNow) new DataContractJsonSerializer(typeof(ResponseBodyIssNow)).ReadObject(stream); } return(true); }
public static bool IssNow(ResponseBodyIssNow responseBodyIssNow, out string formattedString) { StringBuilder sb = new StringBuilder(); sb.Append("responseBodyIssNow").AppendLine(); sb.Append("Timestamp: ").Append(responseBodyIssNow.Timestamp).AppendLine(); sb.Append("Message: ").Append(responseBodyIssNow.Message).AppendLine(); sb.Append("ResponseBodyIssNow_IssPosition.Latitude: ").Append(responseBodyIssNow.IssPosition.Latitude).AppendLine(); sb.Append("ResponseBodyIssNow_IssPosition.Longitude: ").Append(responseBodyIssNow.IssPosition.Longitude).AppendLine(); formattedString = sb.ToString(); return(true); }