Home > Net >  A JArray array composed of JObject objects, add a key to every JObject objects, how do you add
A JArray array composed of JObject objects, add a key to every JObject objects, how do you add

Time:02-20

Such as I have a JArray array as follows
[{" a ": 1," b ", 2}, {" a ": 1," b ", 2}, {" a ": 1," b ", 2},]
Now I want to need addition this
[{" a ": 1," b ": 2," C ": 3}, {" a" : 1, "b" : 2, "C" : 3}, {" a ": 1," b ": 2," C ": 3}]

How to add, please people

CodePudding user response:

The array of objects projected onto the new collection

 
Var Jarray=[{" a ": 1," b ", 2}, {" a ": 1," b ", 2}, {" a ": 1," b ", 2},];

Var T=Jarray. Select (a=& gt; New {a.a, a., c=3}) tolist ();




  •  Tags:  
  • C#
  • Related