Better depends on what you need to use. If you pass this client part to populate the list, then I would prefer json. However, if it will be used on the server side, I will stick with .Net objects.
As a side note, to eliminate the desire to combine rows for data storage, I would define a type that contains both the city and the postal code, for example:
public class MyAddressInfo { public string City { get; set; } public string PostCode {get; set; } }
and then use an array (or List) of them:
List<MyAddressInfo> myList = new List<MyAddressInfo>(); foreach(var res in result.results) { myList.Add(new MyAddressInfo { City = res.CorrespondenceCity, PostCode = res.CorrespondencePostcode }); }
And then return the list as described above. If you need to return an array, you can do this:
return myList.ToArray();
which will be the return type MyAddressInfo[]
@Thomas: For your comment, the declaration of your method should look like this:
public MyAddressInfo[] getBusinessDossierno(string KVKnr) {
What are the other errors you see when compiling this type?
source share