SerializationInfoEnumerator.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. //
  2. // System.Runtime.Serialization.SerializationInfoEnumerator.cs
  3. //
  4. // Author: Duncan Mak ([email protected])
  5. //
  6. // (C) Ximian, Inc.
  7. //
  8. using System;
  9. using System.Collections;
  10. using System.Runtime.Serialization;
  11. namespace System.Runtime.Serialization
  12. {
  13. public sealed class SerializationInfoEnumerator : IEnumerator
  14. {
  15. IDictionaryEnumerator ide;
  16. // Constructor
  17. internal SerializationInfoEnumerator (Hashtable collection)
  18. {
  19. ide = collection.GetEnumerator ();
  20. }
  21. // Properties
  22. public SerializationEntry Current
  23. {
  24. get {
  25. SerializationEntry entry = (SerializationEntry) ide.Value;
  26. return new SerializationEntry (entry.Name, entry.ObjectType, entry.Value);
  27. }
  28. }
  29. object IEnumerator.Current
  30. {
  31. get {
  32. SerializationEntry entry = (SerializationEntry) ide.Value;
  33. return new SerializationEntry (entry.Name, entry.ObjectType, entry.Value);
  34. }
  35. }
  36. public string Name
  37. {
  38. get { return this.Current.Name; }
  39. }
  40. public Type ObjectType
  41. {
  42. get { return this.Current.ObjectType; }
  43. }
  44. public object Value
  45. {
  46. get { return this.Current.Value; }
  47. }
  48. // Methods
  49. public bool MoveNext ()
  50. {
  51. return ide.MoveNext ();
  52. }
  53. public void Reset ()
  54. {
  55. ide.Reset ();
  56. }
  57. }
  58. }