I'm working on the Array in C#, as following code below, the uricontent is a List in which each string contains one JSON value, I could parse the content, however, I want to have one other array or List to store each parsed value, in the example below, rooms variable can store each time one JSON parsed value, now I wish to store those parsed values in one array.
int i = 0; while (uricontent.Count != 0) { var rooms = JObject.Parse(uricontent[i].ToString()) ["rooms"] .Select(x => new { roomID = (string)x["room_name"], Name = WebUtility.HtmlDecode((string)x["room_name"]), Price = PriceHelper.Convert((string)x["discountedTotal"]), Currency = (string)x["currency"], Occupan = (int)x["adult"] }).ToArray(); i++; }
rooms {<>f_AnonymousType11[1]<>f_AnonymousType11[]
[0] { roomID = "Superior 1st floor", Name = "Superior 1st floor", Price = 207.4, Currency = "EUR", Occupan = 2 }
As indicating above, the rooms overwrite the data in each iteration, how can I store those values in one other array like [1]..... [2]..... ....
Thanks