for example i have

[System.Flags]
public enum PrescriptionTypePrint
{
  PrescriptionOnly = 1,
  InstructionOnly = 2,
  Both = PrescriptionOnly | InstructionOnly
}

how i could make it simplify replacing the || to | on the code below

PrescriptionTypePrint pp = PrescriptionTypePrint.Both;

if (pp == PrescriptionTypePrint.PrescriptionOnly || pp == PrescriptionTypePrint.Both)
{
  //execute this block
}

becuase i think this would not work

if (pp == (PrescriptionTypePrint.PrescriptionOnly | PrescriptionTypePrint.Both))
{
  //execute this block
}
// the goal of this if pp has a value of prescription or both it will execute.

thank you so much for the some one who shed me some light

Indeed, your idea does not work.

At bitlevel, PrescriptionOnly = '01', InstructionOnly ='10' and Both = '11'
Make Both equal to 4. Now you have 3 bits(flags) to work with.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.