title: Generic class not returning value all the properties to calling method
body: <p>I want to return the current pages and total pages form a generic method.</p>
  <p>The implementation of the generic function is done as:</p>
  <pre><code>public class PaginatedList&lt;T&gt; : List&lt;T&gt;
  {
      public int PageIndex { get; set; }
      public int TotalPages { get; set; }
  
      public PaginatedList(List&lt;T&gt; items, int count, int pageIndex, int pageSize)
      {
          PageIndex = pageIndex;
          TotalPages = (int)Math.Ceiling(count / (double)pageSize);
  
          this.AddRange(items);
      }
  
      public bool HasPreviousPage
      {
          get
          {
              return (PageIndex &gt; 1);
          }
      }
  
      public bool HasNextPage
      {
          get
          {
              return (PageIndex &lt; TotalPages);
          }
      }
      public static async Task&lt;PaginatedList&lt;T&gt;&gt; CreateAsync(
         IQueryable&lt;T&gt; source, int pageIndex, int pageSize)
      {
          var count = await source.CountAsync();
          var items = await source.Skip(
              (pageIndex - 1) * pageSize)
              .Take(pageSize).ToListAsync();
          return new PaginatedList&lt;T&gt;(items, count, pageIndex, pageSize);
      }
  }
  </code></pre>
  <p>However, this function does not return the <code>PageIndex</code> and <code>TotalPages</code> to the calling function.</p>
  <p>It always returns the <code>items</code> list.</p>
  <p>I am calling the method as:</p>
  <pre><code>public async Task&lt;IActionResult&gt; UserActivityList(string currentFilter,
      string searchString, int? pageIndex, int pageSize = 10)
  {
      if (searchString != null)
      {
          pageIndex = 1;
      }
      else
      {
          searchString = currentFilter;
      }
  
      string CurrentFilter = searchString;
  
  
      IQueryable&lt;UserActivityList&gt; results = _logContext.UserActivityLists;
  
      if (!string.IsNullOrEmpty(searchString))
      {
          results = results.Where(s =&gt; s.Name.Contains(searchString));
      }
  
  
      var UserActivityLists = await PaginatedList&lt;UserActivityList&gt;.CreateAsync(results.AsNoTracking(), pageIndex ?? 1, pageSize);
  
      return Ok(UserActivityLists);
  }
  </code></pre>
  <p>The value of <code>UserActivityList</code>, I have formatted the output to JSON, while am calling through a PostMan.</p>
  <pre><code>[
      {
          &quot;id&quot;: 2186,
          &quot;name&quot;: &quot;abc cbc&quot;
      },
      {
          &quot;id&quot;: 2152,
          &quot;name&quot;: &quot;def efg&quot;
      },
      {
          &quot;id&quot;: 2238,
          &quot;name&quot;: &quot;kgh tbf&quot;
      },
      {
          &quot;id&quot;: 2172,
          &quot;name&quot;: &quot;loc tbh&quot;
      },
      {
          &quot;id&quot;: 1651,
          &quot;name&quot;: &quot;abc abc&quot;
      }
  ]
  </code></pre>
  <p>What is the reason the <code>PaginatedList</code> not returning other property? What is the thing I am missing here?</p>