• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 227
  • Last Modified:

C# operator

What is |=    and &=  equivalent to in vb.net?

const bool multiline = true;
int flags = doc.GetInfoInt(text.Id, "Ff");
if(multiline)
    flags |= 0x1000;        <<<< this line
else
    flags &= ~0x1000;     <<<< this line
doc.SetInfo(text.Id, "/Ff:Num", flags);
0
VBdotnet2005
Asked:
VBdotnet2005
1 Solution
 
Jacques Bourgeois (James Burger)Commented:
When you use And, Or or Not between 2 values, the VB compiler analyzes the context. It will perform a logical (boolean) operation if the operator is used with Boolean values, a bitwise operation (as in your question) if the operators are integer values.

Another thing that you might need to also know is the representation of 0x1000 in VB is &H1000

Thus:

flags Or &H1000
flags And Not &H1000
0
 
VBdotnet2005Author Commented:
Excellent explanation.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now