Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3632170
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T00:29:30+00:00 2026-05-19T00:29:30+00:00

The problem: I have a custom collection PagedList<T> that is being returned from my

  • 0

The problem:

I have a custom collection PagedList<T> that is being returned from my WCF service as PagedListOfEntitySearchResultW_SH0Zpu5 when T is EntitySearchResult object.

I want to reuse this PagedList<T> type between the application and the service.

My scenario:

I’ve created a PagedList<T> type that inherits from List<T>.
This type is on a separated assembly that is referenced on both application and WCF service.

I’m using the /reference option on the scvutil to enable the type reusing. I also don’t want any arrays returned so I also use the /collection to map to the generic List type.
I’m using the following svcutil command to generate the service proxy:

"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\svcutil.exe" 
/collectionType:System.Collections.Generic.List`1 
/reference:..\..\bin\Debug\App.Utilities.dll 
http://localhost/App.MyService/MyService.svc?wsdl  
/namespace:*,"App.ServiceReferences.MyService" 
/out:..\ServiceProxy\MyService.cs

The PagedList object is something like:

 [CollectionDataContract]
 public partial class PagedList<T> : List<T>
 {

  public PagedList() { }

  /// <summary>
  /// Creates a new instance of the PagedList object and doesn't apply any pagination algorithm.
  /// The only calculated property is the TotalPages, everything else needed must be passed to the object.
  /// </summary>
  /// <param name="source"></param>
  /// <param name="pageNumber"></param>
  /// <param name="pageSize"></param>
  /// <param name="totalRecords"></param>
  public PagedList(IEnumerable<T> source, int pageNumber, int pageSize, int totalRecords)
  {
   if (source == null)
    source = new List<T>();

   this.AddRange(source);

   PagingInfo.PageNumber = pageNumber;
   PageSize = pageSize;
   TotalRecords = totalRecords;
  }

  public PagedList(IEnumerable<T> source, PagingInfo paging)
  {
   this.AddRange(source);
   this._pagingInfo = paging;
  }

  [DataMember]
  public int TotalRecords { get; set; }

  [DataMember]
  public int PageSize { get; set; }

  public int TotalPages()
  {
   if (this.TotalRecords > 0 && PageSize > 0)
    return (int)Math.Ceiling((double)TotalRecords / (double)PageSize);
   else
    return 0;
  }

  public bool? HasPreviousPage() 
  { 
   return (PagingInfo.PageNumber > 1); 
  }

  public bool? HasNextPage() { return (PagingInfo.PageNumber < TotalPages()); }

  public bool? IsFirstPage() { return PagingInfo.PageNumber == 1; }

  public bool? IsLastPage() { return PagingInfo.PageNumber == TotalPages(); }

  PagingInfo _pagingInfo = null;
  [DataMember]
  public PagingInfo PagingInfo
  {
   get {
    if (_pagingInfo == null)
     _pagingInfo = new PagingInfo();

    return _pagingInfo;
   }
   set 
   { 
    _pagingInfo = value;
   }
  }
 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T00:29:30+00:00Added an answer on May 19, 2026 at 12:29 am

    I think I know what’s happening here…
    The /collection is conflicting with the /reference on this case as my PagedList object inherits from List<T>.
    I just changed the /collection to the following and it now works.

    /collectionType:App.Utilities.Data.PagedList`1
    

    The thing is that all my collections will the retrieved as PagedList.
    This isn’t really a problem for me but would be need to be able to retrieve List<T> by default and PagedList<T> when needed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.