ListResultDto.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System;
  2. using System.Collections.Generic;
  3. namespace Abp.Application.Services.Dto
  4. {
  5. /// <summary>
  6. /// Implements <see cref="IListResult{T}"/>.
  7. /// </summary>
  8. /// <typeparam name="T">Type of the items in the <see cref="Items"/> list</typeparam>
  9. [Serializable]
  10. public class ListResultDto<T> : IListResult<T>
  11. {
  12. /// <summary>
  13. /// List of items.
  14. /// </summary>
  15. public IReadOnlyList<T> Items
  16. {
  17. get { return _items ?? (_items = new List<T>()); }
  18. set { _items = value; }
  19. }
  20. private IReadOnlyList<T> _items;
  21. /// <summary>
  22. /// Creates a new <see cref="ListResultDto{T}"/> object.
  23. /// </summary>
  24. public ListResultDto()
  25. {
  26. }
  27. /// <summary>
  28. /// Creates a new <see cref="ListResultDto{T}"/> object.
  29. /// </summary>
  30. /// <param name="items">List of items</param>
  31. public ListResultDto(IReadOnlyList<T> items)
  32. {
  33. Items = items;
  34. }
  35. }
  36. }