public static TwitterCoordinates[] ParseMultiple(JArray array) { if (array == null) { return(new TwitterCoordinates[0]); } TwitterCoordinates[] temp = new TwitterCoordinates[array.Count]; for (int i = 0; i < array.Count; i++) { temp[i] = Parse(array.GetArray(i)); } return(temp); }
private TwitterBoundingBox(JObject obj) : base(obj) { // Get the array JArray coordinates = obj.GetArray("coordinates"); // Initialize properties Type = obj.GetString("type"); Coordinates = new TwitterCoordinates[coordinates.Count][]; // Parse the coordinates for (int i = 0; i < coordinates.Count; i++) { Coordinates[i] = TwitterCoordinates.ParseMultiple(coordinates.GetArray(i)); } }
internal static AnalyticsDataRow[] Parse(AnalyticsDataColumnHeader[] columnHeaders, JArray array) { // If the query returns no rows, the array will be NULL if (array == null) { return(new AnalyticsDataRow[0]); } // Initialize the array of rows with a fixed length based on the input array AnalyticsDataRow[] rows = new AnalyticsDataRow[array.Count]; // Iterate through each row for (int i = 0; i < array.Count; i++) { // Get the array of the row JArray row = array.GetArray(i); rows[i] = new AnalyticsDataRow { Index = i }; // Iterate through each cell for (int j = 0; j < row.Count; j++) { // Get the column header AnalyticsDataColumnHeader column = columnHeaders[j]; // Add the key and value to the dictionary rows[i]._cells.Add(column.Name, new AnalyticsDataCell { Row = rows[i], Index = j, Column = column, Value = row.GetString(j) }); // Set the array rows[i].Cells = rows[i]._cells.Values.ToArray(); } } return(rows); }