title: C# MongoDB Driver - How to use UpdateDefinitionBuilder?
body: <p>I looked up a way to work with mongodb's <code>UpdateDefinitionBuilders</code> but the <a href="http://mongodb.github.io/mongo-csharp-driver/2.5/reference/driver/definitions/#update-definition-builder" rel="noreferrer">documentation</a> doesn't really show much...</p>
  
  <p>I need to be able to dynamically build my update queries, so I thought about doing it like this:</p>
  
  <pre><code>var update = Builders&lt;Product&gt;.Update;
  
  update.Set("add A update");
  
  if ()
      update.Set("add X update");
  else
      update.Set("add Y update");
  
  update.Set("add B update");
  
  if ()
      update.Set("add Z update");
  else
      update.Set("add P update");
  
  Collection.UpdateOneAsync(filter, update, updateOptions);
  </code></pre>
  
  <p>But it gives a compilation error:</p>
  
  <p><code>cannot convert from UpdateDefinitionBuilder UpdateDefinition</code></p>
  
  <p>I looked, but couldn't find, a solution how to works with this <code>UpdateDefinitionBuilders</code></p>
  
  <p>Can someone please give a code sample of how to use this class?</p>