RequestBase.cs 663 B

123456789101112131415161718192021222324252627
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Reflection;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace SinochemPosClient.Models
  8. {
  9. public abstract class RequestBase
  10. {
  11. public override string ToString()
  12. {
  13. PropertyInfo[] _PropertyInfos = this.GetType().GetProperties();
  14. var sb = new StringBuilder();
  15. foreach (var info in _PropertyInfos)
  16. {
  17. var value = info.GetValue(this, null) ?? "(null)";
  18. sb.AppendLine(info.Name + ": " + value.ToString());
  19. }
  20. return sb.ToString();
  21. }
  22. }
  23. }