title: How can I prevent the null error while get the children with lambda?
body: <p>I wanna get all the Button in the grid which content is "234" and set them to "123" by lambda.</p>
  
  <p>I do it like this:</p>
  
  <pre><code>Grid.Children.OfType&lt;Button&gt;().Single(Child =&gt; Child.Content.ToString() == "234").Content="123";
  </code></pre>
  
  <p>But now the question is: visual studio reports an error(System.InvalidOperationException) that cannot get any element from it. For example, there are no buttons with the content "234" or there are no buttons in the Grid.</p>
  
  <p>How can I deal with it? Would you please help me? Thank you.</p>