Thomas Levesque 2/21/2010

Automating null checks with Linq expressions

Read Original

This technical article addresses the common problem of verbose null-checking in nested object graphs in C#. It presents a solution using LINQ expressions to analyze and rewrite the abstract syntax tree (AST) of a property access lambda, automatically inserting null checks and returning a default value if any object in the chain is null, with a detailed code implementation.

Automating null checks with Linq expressions

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser