2002-02-16 Duncan Mak <duncan@ximian.com>
[mono.git] / mcs / class / corlib / System.Runtime.Serialization / StreamingContext.cs
1 //
2 // System.Runtime.Serialization.StreamingContext.cs
3 //
4 // Author:
5 //   Miguel de Icaza (miguel@ximian.com)
6 //
7 // (C) Ximian, Inc.  http://www.ximian.com
8 //
9
10 namespace System.Runtime.Serialization {
11
12         public struct StreamingContext {
13                 StreamingContextStates state;
14                 object additional;
15                 
16                 public StreamingContext (StreamingContextStates state)
17                 {
18                         this.state = state;
19                         additional = null;
20                 }
21
22                 public StreamingContext (StreamingContextStates state, object additional)
23                 {
24                         this.state = state;
25                         this.additional = additional;
26                 }
27
28                 public object Context {
29                         get {
30                                 return additional;
31                         }
32                 }
33
34                 public StreamingContextStates State {
35                         get {
36                                 return state;
37                         }
38                 }
39
40                 override public bool Equals (Object o)
41                 {
42                         StreamingContext other;
43                         
44                         if (!(o is StreamingContext))
45                                 return false;
46
47                         other = (StreamingContext) o;
48
49                         return (other.state == this.state) && (other.additional == this.additional);
50                 }
51
52                 override public int GetHashCode ()
53                 {
54                         return (int) state;
55                 }
56         }
57 }