Class1.cs 945 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using System.Text;
  4. using System.Threading.Tasks;
  5. using static WpfAppA.model.Globals;
  6. using System.Threading.Tasks;
  7. using System.Runtime.Serialization;
  8. namespace WpfAppA.model
  9. {
  10. [DataContract]
  11. public class Hero
  12. {
  13. [DataMember]
  14. public string name { get; set; }
  15. [DataMember]
  16. public int Age { get; set; }
  17. [DataMember]
  18. public string power { get; set; }
  19. [DataMember]
  20. public string race { get; set; }
  21. [DataMember(Name = "dateOfLastVaccination")]
  22. private string? stringDate { get; set; }
  23. [IgnoreDataMember]
  24. public DateTime? dateOfLastVaccination
  25. {
  26. get
  27. {
  28. return stringDate == null ? null : DateTime.Parse(stringDate);
  29. }
  30. set
  31. {
  32. stringDate = value.ToString();
  33. }
  34. }
  35. }
  36. }