is it possible to pull a list of particular field values from a collection of generic objects in c?

the best way would be create an interface

public interface IBaseClass{
  public int Id {get; set;}

in this case you could change method header

static PagedList<T> ToPagedList<T>(IEnumerable<T> source, int pageNumber, int pageSize) 
                    where T : IBaseClass

and ids

var ids=items.Select(i => i.Id ).ToList();

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top