Код: Выделить всё
if (users.Any(x => x.userId.ToString() == id))
{
var user = _users.First(x => x.userId.ToString() == id);
_users.Remove(user);
}
//use entitybase to setup the user and its id.i have left that bit out
_users.Add(user)
< /code>
В списке пользователей нет значений, которые соответствуют идентификатору, поэтому строка < /p>
users.Any(x => x.userId.ToString() == id // gives a "Object reference exception"
Подробнее здесь: https://stackoverflow.com/questions/680 ... -selection
Мобильная версия