Updates referencesource to .NET 4.7
[mono-project.git] / mcs / class / referencesource / mscorlib / system / runtime / serialization / streamingcontext.cs
blob978d9ce78c68bbe1a1a35d2a094b35580a1ca3dd
1 // ==++==
2 //
3 // Copyright (c) Microsoft Corporation. All rights reserved.
4 //
5 // ==--==
6 /*============================================================
7 **
8 ** ValueType: StreamingContext
9 **
11 ** Purpose: A value type indicating the source or destination of our streaming.
14 ===========================================================*/
15 namespace System.Runtime.Serialization {
17 using System.Runtime.Remoting;
18 using System;
19 [Serializable]
20 [System.Runtime.InteropServices.ComVisible(true)]
21 public struct StreamingContext {
22 internal Object m_additionalContext;
23 internal StreamingContextStates m_state;
25 public StreamingContext(StreamingContextStates state)
26 : this (state, null) {
29 public StreamingContext(StreamingContextStates state, Object additional) {
30 m_state = state;
31 m_additionalContext = additional;
34 public Object Context {
35 get { return m_additionalContext; }
38 public override bool Equals(Object obj) {
39 if (!(obj is StreamingContext)) {
40 return false;
42 if (((StreamingContext)obj).m_additionalContext == m_additionalContext &&
43 ((StreamingContext)obj).m_state == m_state) {
44 return true;
46 return false;
49 public override int GetHashCode() {
50 return (int)m_state;
53 public StreamingContextStates State {
54 get { return m_state; }
58 // **********************************************************
59 // Keep these in sync with the version in vm\runtimehandles.h
60 // **********************************************************
61 [Serializable]
62 [Flags]
63 [System.Runtime.InteropServices.ComVisible(true)]
64 public enum StreamingContextStates {
65 CrossProcess=0x01,
66 CrossMachine=0x02,
67 File =0x04,
68 Persistence =0x08,
69 Remoting =0x10,
70 Other =0x20,
71 Clone =0x40,
72 CrossAppDomain =0x80,
73 All =0xFF,