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