StreamingContext.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. public struct StreamingContext {
  11. StreamingContextStates state;
  12. object additional;
  13. public StreamingContext (StreamingContextStates state)
  14. {
  15. this.state = state;
  16. additional = null;
  17. }
  18. public StreamingContext (StreamingContextStates state, object additional)
  19. {
  20. this.state = state;
  21. this.additional = additional;
  22. }
  23. public object Context {
  24. get {
  25. return additional;
  26. }
  27. }
  28. public StreamingContextStates {
  29. get {
  30. return state;
  31. }
  32. }
  33. public bool Equals (Object o)
  34. {
  35. StreamingContext other;
  36. if (!(o is StreamingContext))
  37. return false;
  38. other = (StreamingContext) o;
  39. return (other.state == this.state) && (other.additional == this.additional);
  40. }
  41. public int GetHashCode ()
  42. {
  43. // FIXME: Improve this? Is this worth it?
  44. return o.GetHashCode ();
  45. }
  46. }
  47. }