MethodManX
MethodManX

Reputation: 999

What is = Not(VB) in C#

So say if I have this code

circularProgress1.IsRunning = Not circularProgress1.IsRunning // in VB 

how would I make this in C# ?

circularProgress1.IsRunning != circularProgress1.IsRunning // This doesn't work

Upvotes: 3

Views: 201

Answers (2)

Tim Schmelter
Tim Schmelter

Reputation: 460238

circularProgress1.IsRunning = !circularProgress1.IsRunning;

= is an assignment and ! is a negation

The != operator is the opposite of the == operator. It returns true when two objects are unequal. Side-note: In VB.NET the assignement- and the equality-operator are both =.

Upvotes: 15

Jim
Jim

Reputation: 211

circularProgress1.IsRunning = !circularProgress1.IsRunning.

Upvotes: 2

Related Questions