Avatar of lankapala
lankapala
 asked on

C# code

Hi, this is working in the VS2015, How to modify below code to 2012?  (job?.Id > 0)
var job = await c.CreateJob(42626, 52.24525033130513, -0.8287811279296875);
 (job?.Id > 0)

I tried using below
 (job.Id > 0)
But no results
C#

Avatar of undefined
Last Comment
lankapala

8/22/2022 - Mon
zephyr_hex (Megan)

This has nothing to do with the version of Visual Studio.

We can't answer the question unless we know what c is, and what c.CreateJob does.
ASKER CERTIFIED SOLUTION
lankapala

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
kaufmed

This has nothing to do with the version of Visual Studio.
Sure it does. He's using the null-conditional operator. This became available in VS 2015. The equivalent syntax would be:

(job != null && job.Id > 0)

Open in new window

zephyr_hex (Megan)

@käµfm³d 👽

Isn't that a dependency on C# (the language) and not VS (the IDE)?
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
kaufmed

Well, yes and no. MS often releases versions of the language in conjunction with the IDE. If a version of an IDE doesn't support the syntax, then it will not know how to treat it. Try using async/await in VS 2008 and you'll see what I mean : )
lankapala

ASKER
I solved the issue