public List<List<ListAddressGroupingsResponse>> ListAddressGroupings() { List<List<List<object>>> unstructuredResponse = _rpcConnector.MakeRequest<List<List<List<object>>>>(RpcMethods.listaddressgroupings); List<List<ListAddressGroupingsResponse>> structuredResponse = new List<List<ListAddressGroupingsResponse>>(unstructuredResponse.Count); for (Int32 i = 0; i < unstructuredResponse.Count; i++) { for (Int32 j = 0; j < unstructuredResponse[i].Count; j++) { if (unstructuredResponse[i][j].Count > 1) { ListAddressGroupingsResponse response = new ListAddressGroupingsResponse { Address = unstructuredResponse[i][j][0].ToString() }; Decimal balance; Decimal.TryParse(unstructuredResponse[i][j][1].ToString(), out balance); if (unstructuredResponse[i][j].Count > 2) { response.Account = unstructuredResponse[i][j][2].ToString(); } if (structuredResponse.Count < i + 1) { structuredResponse.Add(new List<ListAddressGroupingsResponse>()); } structuredResponse[i].Add(response); } } } return structuredResponse; }
public async Task<List<List<ListAddressGroupingsResponse>>> ListAddressGroupings() { var unstructuredResponse = await _rpcConnector.MakeRequestAsync<List<List<List<object>>>>(RpcMethods.listaddressgroupings); var structuredResponse = new List<List<ListAddressGroupingsResponse>>(unstructuredResponse.Count); for (var i = 0; i < unstructuredResponse.Count; i++) { for (var j = 0; j < unstructuredResponse[i].Count; j++) { if (unstructuredResponse[i][j].Count > 1) { var response = new ListAddressGroupingsResponse { Address = unstructuredResponse[i][j][0].ToString() }; decimal balance; decimal.TryParse(unstructuredResponse[i][j][1].ToString(), out balance); if (unstructuredResponse[i][j].Count > 2) { response.Account = unstructuredResponse[i][j][2].ToString(); } if (structuredResponse.Count < i + 1) { structuredResponse.Add(new List<ListAddressGroupingsResponse>()); } structuredResponse[i].Add(response); } } } return structuredResponse; }