public void SelectItem(CityListItem city) { if (city == null) { return; } IEnumerator <CityListItem> enumerator = ((Collection <CityListItem>) this._searchVM.Collection).GetEnumerator(); try { while (enumerator.MoveNext()) { CityListItem current = enumerator.Current; int num = current.Id == city.Id ? 1 : 0; current.IsSelected = num != 0; } } finally { if (enumerator != null) { enumerator.Dispose(); } } }
public void SelectItem(CityListItem city) { if (city == null) { return; } foreach (CityListItem cityListItem in (Collection <CityListItem>) this._searchVM.Collection) { int num = cityListItem.Id == city.Id ? 1 : 0; cityListItem.IsSelected = num != 0; } }