How come is a variable appended by a question mark?

  • Thread starter Thread starter Stan Huang at Taiwan
  • Start date Start date
S

Stan Huang at Taiwan

Guest
I can't find any introduction about what a question mark appending a variable mean. As below, a question mark is appended after _bar. How come? It's from Implement a Dispose method

I sometimes found such usage of question mark in C# program samples but no any tutorial for such usage.

public sealed class Foo : IDisposable { private readonly IDisposable _bar; public Foo() { _bar = new Bar(); } public void Dispose() { _bar?.Dispose(); } }

Continue reading...
 
Back
Top