What does the question mark in member access mean in C#?

Wickoo

Can someone please explain to me what does the question mark in the member access in the following code means?

Is it part of standard C#? I get parse errors when trying to compile this file in Xamarin Studio.

this.AnalyzerLoadFailed?.Invoke(this, new AnalyzerLoadFailureEventArgs(AnalyzerLoadFailureEventArgs.FailureErrorCode.NoAnalyzers, null, null));

AnalyzerFileReference.cs line 195

Ehsan Sajjad

It is Null Propagation operator introduced in C# 6, it will call the method only if object this.AnalyzerLoadFailed is not null:

this.AnalyzerLoadFailed?.Invoke(this, new AnalyzerLoadFailureEventArgs(AnalyzerLoadFailureEventArgs.FailureErrorCode.NoAnalyzers, null, null));

is equal to :

if( this.AnalyzerLoadFailed != null)
    this.AnalyzerLoadFailed.Invoke(this, new AnalyzerLoadFailureEventArgs(AnalyzerLoadFailureEventArgs.FailureErrorCode.NoAnalyzers, null, null));

See C# 6.0 – Null Propagation Operator , also you can see here

i also once wrote about this upcoming feature in c# 6 here

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

What does question mark mean?

From Java

What does question mark and dot operator ?. mean in C# 6.0?

From Dev

What does question mark equals mean in CoffeeScript?

From Dev

What does this question mark mean in Flow: "?() => void"

From Dev

What does the question mark in "Decimal?" mean?

From Dev

XML what does that question mark mean

From Dev

What does the triple question mark mean in scala?

From Dev

What does the question mark in java mean?

From Dev

What does .php question mark = mean?

From Dev

What does the question mark in terminal command mean?

From Dev

What does the "?" (question mark) mean in javascript?

From Dev

What does this two question mark mean?

From Dev

What does the question mark in terminal command mean?

From Dev

What does hypothesis with operator with question mark mean

From Java

What does double question mark (??) operator mean in PHP

From Dev

What does "type" mean and is there is a special use for a question mark in ECMA 6?

From Dev

What does the question mark mean in a type parameter bound?

From Dev

What does the question mark icon by a file name mean in Aptana?

From Dev

What does %-mark mean in Clojure?

From Dev

What do a question mark (?) and an ampersand (&) mean in a URL?

From Dev

What does a question mark after the file name mean using ls terminal command?

From Dev

what does it mean to have a void* member of a struct in c?

From Java

What does an exclamation mark mean in the Swift language?

From Dev

What does the exclamation mark mean for a swift initializer?

From Dev

What does this exclamation mark mean in Javascript?

From Dev

What does an exclamation mark mean in diff output?

From Dev

What does the exclamation mark mean in udev rule?

From Dev

What does this PHP syntax mean? (question marks)

From Java

What does exclamation mark mean before invoking a method in C# 8.0?

Related Related

  1. 1

    What does question mark mean?

  2. 2

    What does question mark and dot operator ?. mean in C# 6.0?

  3. 3

    What does question mark equals mean in CoffeeScript?

  4. 4

    What does this question mark mean in Flow: "?() => void"

  5. 5

    What does the question mark in "Decimal?" mean?

  6. 6

    XML what does that question mark mean

  7. 7

    What does the triple question mark mean in scala?

  8. 8

    What does the question mark in java mean?

  9. 9

    What does .php question mark = mean?

  10. 10

    What does the question mark in terminal command mean?

  11. 11

    What does the "?" (question mark) mean in javascript?

  12. 12

    What does this two question mark mean?

  13. 13

    What does the question mark in terminal command mean?

  14. 14

    What does hypothesis with operator with question mark mean

  15. 15

    What does double question mark (??) operator mean in PHP

  16. 16

    What does "type" mean and is there is a special use for a question mark in ECMA 6?

  17. 17

    What does the question mark mean in a type parameter bound?

  18. 18

    What does the question mark icon by a file name mean in Aptana?

  19. 19

    What does %-mark mean in Clojure?

  20. 20

    What do a question mark (?) and an ampersand (&) mean in a URL?

  21. 21

    What does a question mark after the file name mean using ls terminal command?

  22. 22

    what does it mean to have a void* member of a struct in c?

  23. 23

    What does an exclamation mark mean in the Swift language?

  24. 24

    What does the exclamation mark mean for a swift initializer?

  25. 25

    What does this exclamation mark mean in Javascript?

  26. 26

    What does an exclamation mark mean in diff output?

  27. 27

    What does the exclamation mark mean in udev rule?

  28. 28

    What does this PHP syntax mean? (question marks)

  29. 29

    What does exclamation mark mean before invoking a method in C# 8.0?

HotTag

Archive