You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I instinctively thought Pagination as IEnumerable and try to foreach it only to realise it just a class holding actual Results in it, so why dont we directly implement IEnumerable for it some thing like
publicclassPagination<TSource>:IEnumerable<TSource>{// other PropertiespublicIEnumerator<TSource>GetEnumerator()=>Results.GetEnumerator();IEnumeratorIEnumerable.GetEnumerator()=>GetEnumerator();}
The text was updated successfully, but these errors were encountered:
@NotAsea I never thought of this, and I just tried to implement it.
This is a nice recommendation, and I like it, but this approach has a problem when it comes to JSON<=>Object Serialization. The fields (TotalItems, TotalPages, NextPage, etc.) are lost.
I know that you can set global configuration on the Startup file but I believe that it is much better to keep it this way, the dot results (.Results) is easy to understand.
I instinctively thought
Pagination
asIEnumerable
and try to foreach it only to realise it just a class holding actualResults
in it, so why dont we directly implementIEnumerable
for it some thing likeThe text was updated successfully, but these errors were encountered: