Tue Sep 10 12:12:51 CEST 2002 Paolo Molaro <lupus@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         [Serializable]
13         public struct StreamingContext {
14                 StreamingContextStates state;
15                 object additional;
16                 
17                 public StreamingContext (StreamingContextStates state)
18                 {
19                         this.state = state;
20                         additional = null;
21                 }
22
23                 public StreamingContext (StreamingContextStates state, object additional)
24                 {
25                         this.state = state;
26                         this.additional = additional;
27                 }
28
29                 public object Context {
30                         get {
31                                 return additional;
32                         }
33                 }
34
35                 public StreamingContextStates State {
36                         get {
37                                 return state;
38                         }
39                 }
40
41                 override public bool Equals (Object o)
42                 {
43                         StreamingContext other;
44                         
45                         if (!(o is StreamingContext))
46                                 return false;
47
48                         other = (StreamingContext) o;
49
50                         return (other.state == this.state) && (other.additional == this.additional);
51                 }
52
53                 override public int GetHashCode ()
54                 {
55                         return (int) state;
56                 }
57         }
58 }