PageRenderTime 11ms CodeModel.GetById 2ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

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

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