private SortedList <string, object> GetGamePrefs() { var sortedList = new SortedList <string, object>(); var enumerator = Enum.GetValues(typeof(EnumGamePrefs)).GetEnumerator(); while (enumerator.MoveNext()) { if (enumerator.Current == null) { continue; } var enumGamePrefs = (EnumGamePrefs)(int)enumerator.Current; if (!IsViewablePref(enumGamePrefs)) { continue; } try { sortedList.Add(enumGamePrefs.ToString(), GamePrefs.GetObject(enumGamePrefs)); } catch (Exception) { //Log.Out("Exception getting object for " + enumGamePrefs); } } (enumerator as IDisposable)?.Dispose(); sortedList.Add("ServerHostIP", BCUtils.GetIPAddress()); return(sortedList); }