title: C#: extract data from a collection and store it in an array
body: <p>I want to extract a data collection based on AID and store in a new collection have shared a sample data collection below as which create separate collection based on ID </p>
  
  <pre><code>  [
      {
          "id": 116,
          "AId": 168755,
          "Name": "Model1",
          "isRefDemand": false,
          "forecastType": "N-2",
          "prodQty": 0,
          "prodMonth": "2020/03",
  
      },
      {
          "id": 117,
          "AId": 168755,
          "Name": "Model1",
          "isRefDemand": false,
          "forecastType": "N-3",
          "prodQty": 0,
          "prodMonth": "2020/04",
  
      },
      {
          "id": 118,
          "AId": 168755,
          "Name": "Model1",
          "isRefDemand": false,
          "forecastType": "N-4",
          "prodQty": 0,
          "prodMonth": "2020/05",
  
      },
  
      {
          "id": 61,
          "AId": 168383,
          "Name": "Model2",
          "isRefDemand": false,
          "forecastType": "N-2",
          "prodQty": 0,
          "prodMonth": "2020/03",
  
      },
      {
          "id": 62,
          "AId": 168383,
          "Name": "Model2",
          "isRefDemand": false,
          "forecastType": "N-3",
          "prodQty": 0,
          "prodMonth": "2020/04",
  
      }
      ]
  
  want to retrive and store as 
          {
  
          "AId": 168755,
          "Name": "Model1",
          "isRefDemand": false,
          "forecastType":
          {
          "forecastTypeN-2":"N-2",
          "forecastTypeN-3": "N-3",
          "forecastTypeN-4": "N-4",
          }
          "prodQty":
          {
          "prodQty0": 0,
          "prodQty1": 0,
          "prodQty2": 0,
          }
  
      },
      {
  
  
          "AId": 168383,
          "Name": "Model2",
          "isRefDemand": false,
          "forecastType":
          {
          "forecastTypeN-2": "N-2",
          "forecastType1N-3": "N-3",
          }
          "prodQty":
          {
          "prodQty": 0,
          "prodQty1": 0,
          }
  
      },
  </code></pre>