Null parameter alternative C# 6.0

Viewed 2107

I have seen new feature in C# 6 which allows code to skip if statements for null checks.

For example:

return p?.ToString();

How can this be done for calling a method to which p needs to be passed as parameter (without old if/else)?

The way I would normally write this with C# pre-6:

 p != null ? callmethod(p) : null

is there something better in C# 6?

4 Answers
Related