C# code

lankapala
lankapala used Ask the Experts™
on
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
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2010

Commented:
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.
it's ok i solved the issue.
ǩa̹̼͍̓̂ͪͤͭ̓u͈̳̟͕̬ͩ͂̌͌̾̀ͪf̭̤͉̅̋͛͂̓͛̈m̩̘̱̃e͙̳͊̑̂ͦ̌ͯ̚d͋̋ͧ̑ͯ͛̉Glanced up at my screen and thought I had coded the Matrix...  Turns out, I just fell asleep on the keyboard.
Most Valuable Expert 2011
Top Expert 2015

Commented:
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

Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

Top Expert 2010

Commented:
@käµfm³d 👽

Isn't that a dependency on C# (the language) and not VS (the IDE)?
ǩa̹̼͍̓̂ͪͤͭ̓u͈̳̟͕̬ͩ͂̌͌̾̀ͪf̭̤͉̅̋͛͂̓͛̈m̩̘̱̃e͙̳͊̑̂ͦ̌ͯ̚d͋̋ͧ̑ͯ͛̉Glanced up at my screen and thought I had coded the Matrix...  Turns out, I just fell asleep on the keyboard.
Most Valuable Expert 2011
Top Expert 2015

Commented:
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 : )

Author

Commented:
I solved the issue

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial