0

I've encountered this operator in C# when dealing with custom events: MyEvent?.Invoke(this, new EventArgs());. What is the purpose of the ?. portion of this statement?

JTW
  • 3,546
  • 8
  • 35
  • 49
  • Yup, definitely a dup. For some reason that question didn't come up when I searched... the syntax seems to bugger up the search engine for some reason. – JTW Apr 20 '17 at 01:25
  • 1
    Yeah, it's hard to find what operators mean in C#. The best place to look is the [MSDN article](https://msdn.microsoft.com/en-us/library/6a71f45d.aspx) then at least you get the right name to search for. – Steve Apr 20 '17 at 01:28

1 Answers1

-1

It's making sure it's not null. They have these in swift and their called optionals. If the variable is null then it returns null

Cameron Monks
  • 107
  • 1
  • 7