summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLevi Bostian <levi.bostian@gmail.com>2015-10-12 23:19:24 -0500
committerLevi Bostian <levi.bostian@gmail.com>2015-10-12 23:19:24 -0500
commitc15be9b0131ac5e80e66d5c4158fed0a29f749cb (patch)
treeb7c3b9136e84f6dc191cc6e7a2a6679637adf07c
parentf3b1fb73efb3c92e5074c1ea7a88b1ed4b765cd4 (diff)
parent5bbd8419b232bff0baae40506351f733e0e30462 (diff)
Merge pull request #1466 from csuich2/csharp-null-propagation
Added info C# null-propagation
-rw-r--r--csharp.html.markdown3
1 files changed, 3 insertions, 0 deletions
diff --git a/csharp.html.markdown b/csharp.html.markdown
index a4dff948..1f926d0b 100644
--- a/csharp.html.markdown
+++ b/csharp.html.markdown
@@ -443,6 +443,9 @@ on a new line! ""Wow!"", the masses cried";
// ?? is syntactic sugar for specifying default value (coalesce)
// in case variable is null
int notNullable = nullable ?? 0; // 0
+
+ // ?. is an operator for null-propogation - a shorthand way of checking for null
+ nullable?.Print(); // Use the Print() extension method if nullable isn't null
// IMPLICITLY TYPED VARIABLES - you can let the compiler work out what the type is:
var magic = "magic is a string, at compile time, so you still get type safety";