Код: Выделить всё
public bool AddGroup()
{
if (this.GroupName == "")
MessageBox.Show("String is empty");
if (this.GroupName == "") //GroupName is "Supervisor" here
**throw new Exception("No group name specified");**
try
{
//Some other code...;
return true;
}
catch
{
throw new Exception("Cannot create this group");
}
}
Однако всегда достигается новое исключение, но оно не генерирует исключение. Выполнение переходит к следующей строке без выбрасывания.
Я также пробовал string.equals и string.IsNullOrEmpty, но результат тот же.
Подробнее здесь: https://stackoverflow.com/questions/790 ... suppressed
Мобильная версия