自己做个枚举 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication2 { //相关数据查询Cad帮助,下面只是示例 public enum OSMode { ByEnd = 1, ByMid = 2 } public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { //设置 OSMode osm = OSMode.ByEnd | OSMode.ByMid; if ((osm & OSMode.ByEnd) == OSMode.ByEnd) { MessageBox.Show("ByEnd"); //去除ByEnd osm = osm ^ OSMode.ByEnd; } } } } |