Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AV1545: Add example for null-conditional operator #102

Closed
bkoelman opened this issue Oct 10, 2017 · 0 comments
Closed

AV1545: Add example for null-conditional operator #102

bkoelman opened this issue Oct 10, 2017 · 0 comments

Comments

@bkoelman
Copy link
Contributor

The null-conditional operator enables shorter syntax.
For example:

if (employee.Manager != null)
{
    return employee.Manager.Name;
}
else
{
    return null;
}

can be rewritten as:

return employee.Manager?.Name;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant