using System.Collections.ObjectModel; namespace Microsoft.Xna.Framework.Net { /// /// Collection of local network gamers in a session. /// public class LocalGamerCollection : ReadOnlyCollection { internal LocalGamerCollection(IList list) : base(list) { } /// /// Finds a local gamer by their ID. /// /// The ID to search for. /// The local gamer with the specified ID, or null if not found. public LocalNetworkGamer FindGamerById(string id) { foreach (var gamer in this) { if (gamer.Id == id) return gamer; } return null; } /// /// Gets the host gamer of the session (if local). /// public LocalNetworkGamer Host { get { foreach (var gamer in this) { if (gamer.IsHost) return gamer; } return null; } } } }