Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the equivalent of |= in Visual Basic?

Tags:

c#

vb.net

What is the equivalent of the |= operator in Visual Basic? For example (C#):

flags |= MyEnum.SomeFlag

like image 859
Jake Petroules Avatar asked Oct 25 '10 01:10

Jake Petroules


People also ask

What does &= mean in Visual Basic?

The &= operator concatenates the String expression on its right to the String variable or property on its left, and assigns the result to the variable or property on its left.

What is the difference between += and =+?

+ is an arithmetic operator while += is an assignment operator.. When += is used, the value on the RHS will be added to the variable on the LHS and the resultant value will be assigned as the new value of the LHS..


2 Answers

flags = flags Or MyEnum.SomeFlag

like image 136
Gabe Avatar answered Sep 25 '22 01:09

Gabe


In C#, |= is the Or assignment operator.

There's no equivalent operator in VB.

See the list of Assignment Operators (Visual Basic).

like image 38
Leniel Maccaferri Avatar answered Sep 27 '22 01:09

Leniel Maccaferri