Added hammock project to debug streaming issues
[pithos-ms-client] / trunk / hammock / src / net35 / ICSharpCode.SharpZipLib.Silverlight / Serialization / SerializableDateTime.cs
1 using System;
2
3 namespace ICSharpCode.SharpZipLib.Silverlight.Serialization
4 {
5     [Serializable]
6     public class SerializableDateTime : SerializableBase
7     {
8         public DateTime DateTime { get; set; }
9        
10         public SerializableDateTime(int year, int month, int day)
11         {
12             DateTime = new DateTime(year, month, day);
13         }
14
15         public SerializableDateTime()
16         {
17             
18         }
19
20         protected override object GetValue(System.Reflection.FieldInfo field)
21         {
22             return field.DeclaringType == typeof (SerializableDateTime) ? field.GetValue(this) : null;
23         }
24
25         protected override void SetValue(System.Reflection.FieldInfo field, object value)
26         {
27             if (field.DeclaringType == typeof(SerializableDateTime))
28             {
29                 field.SetValue(this, value);
30             }
31         }
32
33         public bool Equals(SerializableDateTime other)
34         {
35             if (ReferenceEquals(null, other))
36             {
37                 return false;
38             }
39             return ReferenceEquals(this, other) || Equals(other.DateTime, DateTime);
40         }
41
42         public override bool Equals(object other)
43         {
44             if (ReferenceEquals(null, other))
45             {
46                 return false;
47             }
48             if (ReferenceEquals(this, other))
49             {
50                 return true;
51             }
52             return other.GetType() == typeof (SerializableDateTime) && Equals((SerializableDateTime) other);
53         }
54
55         public override int GetHashCode()
56         {
57             return DateTime.GetHashCode();
58         }
59     }
60 }