I have a if condition for a Enum. My enum is :
public enum EmploymentType
{
Type1 = 1,
Type2 = 2,
Type3 = 3
}
and this condition
EmploymentType type = EmploymentType.Type1 ;
if (type.HasFlag(EmploymentType.Type1 | EmploymentType.Type2 )) //if (type == (EmploymentType.Type1 | EmploymentType.Type2 ))
{
return true;
}
else
{
return false;
}
Expected true result for this condition, but result is false. Why?