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