StreamingContext.cs 1009 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 State {
  29. get {
  30. return state;
  31. }
  32. }
  33. override 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. override public int GetHashCode ()
  42. {
  43. return (int) state;
  44. }
  45. }
  46. }