title: Linq Select on dynamic List of Object c#
body: <p>Hello I am working on asp.net mvc project
  and call an Api which return  List now I need to select some object from the list based on requirement but I am unable to use linq select because it is not working which dyamic.</p>
  
  <p><strong>Code Api Get List</strong></p>
  
  <pre><code>List&lt;dynamic&gt; allblogswithuser = getallBlogs();
  ViewData["AuthorBlogs"] = allblogswithuser.Where(a =&gt; a.postBlogType == "2").ToList();
  </code></pre>
  
  <p>The second line fails due to this</p>
  
  <p><strong>Screen shot:</strong>
  <a href="https://i.stack.imgur.com/vJ7pU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vJ7pU.png" alt="enter image description here"></a></p>
  
  <p><strong>Api Call</strong></p>
  
  <pre><code>private List&lt;dynamic&gt; getallBlogs()
  {
      try
      {
          using (HttpClient httpClient = new HttpClient())
          {
              httpClient.BaseAddress = new Uri(baseUri);
  
              httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
              // httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
              //httpClient.Timeout = TimeSpan.FromSeconds(30.0);
              var response = httpClient.GetStringAsync(string.Format("api/client/getAllBlogs")).Result;
  
              return JsonConvert.DeserializeObject&lt;List&lt;dynamic&gt;&gt;(response);
          }
      }
      catch (Exception exp)
      {
  
          return null;
      }
  
  }  //api get
  </code></pre>
  
  <p><strong>Json</strong></p>
  
  <blockquote>
    <p>{"user": {
      "userID": 1234,
      "userCode": "89-3ABC",
      "biography": "good bio                                                                                            ",
      "visitorCode": null,
      "publicName": "test@test.com",
      "firstName": " change",
      "lastName": "isgood",
      "userTypeID": 1,
      "address1": "-",
      "address2": "-",
      "nationalIdentity": "-",
      "city": "-",
      "state": null,
      "country": "-",
      "DOB": "0001-01-01T00:00:00",
      "gender": null,
      "emailID": "test@test.com",
      "phoneNumber": "0",
      "mobileNumber": null,
      "faxNumber": null,
      "bestTimeCall": null,
      "title": null,
      "alternateEmailID": null,
      "zipCode": null,
      "isRegister": true,
      "websitesID": 3,
      "extra1": "TEST",
      "extra2": null,
      "extra3": "test@test.com",
      "IsActive": true,
      "createDate": "2018-05-04T07:11:38.997",
      "createBy": null,
      "modifiedDate": null,
      "modifiedBy": null,
      "Timestamp": "AAAAAAAAHwE=",
      "standardTime": "GMT Standard Time",
      "profileImage": ".png",
      "properEmail": null,
      "headerImage": "user-bg.jpg",
      "verifiedUser": false,
      "occupation": "good occ",
      "officeAddress": null,
      "companyName": null
    }}</p>
  </blockquote>
  
  <p>and </p>
  
  <blockquote>
    <p>{
      "blogs": {
        "postID": 103,
        "postBlogType": "1                                                                                                   ",
        "blogImage": ".jpg",
        "slug": "an-odyssey-in-the-thal-desert",
        "title": "An odyssey in the Thal desert",
        "postContent": "<p>I&rsquo;ve always been fascinated by the desert. The idea of a giant land of distant horizons, framed by a flawless canopy of blue sky, and complete silence. In my mind, being in a desert is like existing in a vacuum &mdash; no beginning, no end, and nothing around but space. A perfect, silent void. Few people appreciate the sheer beauty of a desert &mdash; far from the barren wastelands that we imagine them to be, they are dramatic, almost spiritual places, filled with life. Being from Australia, I had experienced deserts long before visiting Pakistan. My native country, an entire continent, is filled with deserts which in some cases stretch thousands of kilometres to the seashore.</p>",
        "createDate": null,
        "publishDate": "2018-05-04T12:30:52",
        "userID": 1234,
        "categoryID": 22,
        "isShow": false,
        "isApproved": false,
        "websiteID": 6,
        "miniPostContent": "<p>test</p>",
        "modifedDate": "2018-05-04T12:31:46.237",
        "pageTitle": "test",
        "pageKeyword": "tset",
        "pageDescribtion": "test",
        "Tags": [
          ""
        ],
        "CombinedTags": ""
      },
      "user": {
        "userID": 1234,
        "userCode": "8124-ABC",
        "biography": "good bio                                                                                            ",
        "visitorCode": null,
        "publicName": "test@test.com",
        "firstName": " change",
        "lastName": "isgood",
        "userTypeID": 1,
        "address1": "-",
        "address2": "-",
        "nationalIdentity": "-",
        "city": "-",
        "state": null,
        "country": "-",
        "DOB": "0001-01-01T00:00:00",
        "gender": null,
        "emailID": "test@test.com",
        "phoneNumber": "0",
        "mobileNumber": null,
        "faxNumber": null,
        "bestTimeCall": null,
        "title": null,
        "alternateEmailID": null,
        "zipCode": null,
        "isRegister": true,
        "websitesID": 3,
        "extra1": "TEST",
        "extra2": null,
        "extra3": "test@test.com",
        "IsActive": true,
        "createDate": "2018-05-04T07:11:38.997",
        "createBy": null,
        "modifiedDate": null,
        "modifiedBy": null,
        "Timestamp": "AAAAAAAAHwE=",
        "standardTime": "GMT Standard Time",
        "profileImage": ".png",
        "properEmail": null,
        "headerImage": "user-bg.jpg",
        "verifiedUser": false,
        "occupation": "good occ",
        "officeAddress": null,
        "companyName": null
      }
    }</p>
  </blockquote>
  
  <p>Please help.</p>