Solved

C# operator

Posted on 2014-02-05
2
218 Views
Last Modified: 2014-02-05
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
Comment
Question by:VBdotnet2005
2 Comments
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 500 total points
ID: 39837107
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
 

Author Comment

by:VBdotnet2005
ID: 39837208
Excellent explanation.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now