Dogukan Demir
Dogukan Demir

Reputation: 121

equivalent code of Or command in vb.net

I want to learn how can I use Or command (VB.NET) in C#?

I have an example:

foundCommand = _applicationObject.Commands.AddNamedCommand(_addInInstance, name, name, caption, _
                                True, iconID, Nothing, vsCommandStatus.vsCommandStatusSupported Or vsCommandStatus.vsCommandStatusEnabled)

I want to use vsCommandStatus.vsCommandStatusNotSupported Or vsCommandStatus.vsCommandStatusEnabled together in C#.

Upvotes: 1

Views: 293

Answers (2)

Sergey Kalinichenko
Sergey Kalinichenko

Reputation: 726609

Here is a little table of VB.NET to C# operators:

VB.NET     C#
--------   --
And        &
AndAlso    &&
Or         |
OrElse     ||
Xor        ^
Mod        %
Not        !

Upvotes: 4

Daniel A. White
Daniel A. White

Reputation: 190943

Use the bitwise OR operator | to link enum flag values, which is your case.

vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled

For conditionals or Boolean values, use the logical OR operator ||.

Upvotes: 4

Related Questions