Code: readonly HashSet<IMyFaction> _tmp_factions = new HashSet<IMyFaction> (); readonly List<IMyIdentity> _tmp_identities = new List<IMyIdentity> (); HashSet<IMyFaction> GetAllFactions () { _tmp_factions.Clear (); _tmp_identities.Clear (); MyAPIGateway.Players.GetAllIdentites (_tmp_identities); foreach (var identity in _tmp_identities) { var playerFaction = MyAPIGateway.Session.Factions.TryGetPlayerFaction (identity.PlayerId); if (playerFaction != null) _tmp_factions.Add (playerFaction); } return _tmp_factions; }

Example 2 (missing feature):It is pretty awkward and not intuitive to get access to some basic game information. For instance factions. There is no simple way to get a list of all factions. I'm even wondering why the type returned by MyAPIGateway.Session.Faction is called IMyFactionCollection. It is a fact that the interface IMyFactionCollection does not extend the ICollection interface.The only way to get a list/set of all factions I know is: