PageRenderTime 42ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/Source/ResourceManagement.Client/WsTransfer/ResourceTimeProperty.cs

#
C# | 44 lines | 42 code | 2 blank | 0 comment | 2 complexity | 16463ecb9079c9f2962dcabdc87638f2 MD5 | raw file
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Xml.Serialization;
  4. using System.Text;
  5. namespace Microsoft.ResourceManagement.Client.WsTransfer
  6. {
  7. [XmlRoot(ElementName = Constants.Rm.ResourceTimeProperty, Namespace = Constants.Rm.Namespace)]
  8. public class ResourceTimeProperty
  9. {
  10. public ResourceTimeProperty()
  11. : this(DateTime.Now)
  12. {
  13. }
  14. public ResourceTimeProperty(DateTime value)
  15. {
  16. this.value = value;
  17. }
  18. private DateTime value;
  19. [XmlText(Type = typeof(String))]
  20. public String Value
  21. {
  22. get
  23. {
  24. return this.value.ToString();
  25. }
  26. set
  27. {
  28. if (value != null)
  29. {
  30. try
  31. {
  32. this.value = DateTime.Parse(value);
  33. }
  34. catch (FormatException)
  35. {
  36. throw;
  37. }
  38. }
  39. }
  40. }
  41. }
  42. }