AvailableNetworkSessionCollection.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System.Collections.ObjectModel;
  2. namespace Microsoft.Xna.Framework.Net
  3. {
  4. /// <summary>
  5. /// Collection of available network sessions.
  6. /// </summary>
  7. public class AvailableNetworkSessionCollection : ReadOnlyCollection<AvailableNetworkSession>, IDisposable
  8. {
  9. private bool disposed = false;
  10. internal AvailableNetworkSessionCollection() : base(new List<AvailableNetworkSession>()) { }
  11. internal AvailableNetworkSessionCollection(IList<AvailableNetworkSession> sessions) : base(sessions) { }
  12. /// <summary>
  13. /// Disposes of the collection resources.
  14. /// </summary>
  15. public void Dispose()
  16. {
  17. Dispose(true);
  18. GC.SuppressFinalize(this);
  19. }
  20. /// <summary>
  21. /// Disposes of the collection resources.
  22. /// </summary>
  23. /// <param name="disposing">True if disposing managed resources.</param>
  24. protected virtual void Dispose(bool disposing)
  25. {
  26. if (!disposed)
  27. {
  28. if (disposing)
  29. {
  30. // Clean up managed resources if needed
  31. // The ReadOnlyCollection doesn't need special cleanup
  32. }
  33. disposed = true;
  34. }
  35. }
  36. }
  37. }