StreamingContext.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //
  2. // System.Runtime.Serialization.StreamingContext.cs
  3. //
  4. // Author:
  5. // Miguel de Icaza ([email protected])
  6. //
  7. // (C) Ximian, Inc. http://www.ximian.com
  8. //
  9. namespace System.Runtime.Serialization {
  10. [Serializable]
  11. public struct StreamingContext {
  12. StreamingContextStates state;
  13. object additional;
  14. public StreamingContext (StreamingContextStates state)
  15. {
  16. this.state = state;
  17. additional = null;
  18. }
  19. public StreamingContext (StreamingContextStates state, object additional)
  20. {
  21. this.state = state;
  22. this.additional = additional;
  23. }
  24. public object Context {
  25. get {
  26. return additional;
  27. }
  28. }
  29. public StreamingContextStates State {
  30. get {
  31. return state;
  32. }
  33. }
  34. override public bool Equals (Object o)
  35. {
  36. StreamingContext other;
  37. if (!(o is StreamingContext))
  38. return false;
  39. other = (StreamingContext) o;
  40. return (other.state == this.state) && (other.additional == this.additional);
  41. }
  42. override public int GetHashCode ()
  43. {
  44. return (int) state;
  45. }
  46. }
  47. }