Код: Выделить всё
public enum animals : int
{
Cat = 1
,Dog = 2
,Mouse = 3
,Rat = 4
,Lizzard = 5
}
Код: Выделить всё
int res_flags = 0;
if ((bool)this.chbCat.IsChecked) res_flags |= (int)animals.Cat;
if ((bool)this.chbDog.IsChecked) res_flags |= (int)animals.Dog;
if ((bool)this.chbMouse.IsChecked) res_flags |= (int)animals.Mouse;
if ((bool)this.chbRat.IsChecked) res_flags |= (int)animals.Rat;
if ((bool)this.chbLizzard.IsChecked) res_flags |= (int)animals.Lizzard;
Подробнее здесь: https://stackoverflow.com/questions/791 ... ined-value
Мобильная версия