title: Deserializing Yaml into c# object
body: <p>I just started working with Yaml and would really appreciate some input. I am creating a YAML and trying to deserailize it to existing C# class.
  Existing C# class:</p>
  
  <pre><code>    [System.Xml.Serialization.XmlIncludeAttribute(typeof(FooType))]
  
      public partial class BarType {
  
         private int barVariable;
  
         public Int Bar {
          get {
              return this.barVariable;
          }
          set {
              this.barVariable = value;
          }
      }
  
  
      }
  
      public partial class FooType : BarType {
  
         private string fooVariable;
         public string Foo {
          get {
              return this.fooVariable;
          }
          set {
              this.fooVariable = value;
          }
      }
  
  
  [System.Xml.Serialization.XmlRootAttribute("HeadType", Namespace="xyz", IsNullable=false)]
  
  public partial class HeadType {
  
      private BarType[] barTypesField;
  
      [System.Xml.Serialization.XmlArrayItemAttribute("FooService", typeof(FooType), IsNullable=false)]
  
        public BarType[] BarTypes {
            get {
                  return this.barTypesField;
                }
             set {
                  this.barTypesField = value;
                 }
              }
  </code></pre>
  
  <p>Now I have a Yaml,</p>
  
  <pre><code>HeadType:
    - Bar: 0
    - Bar: 29
  </code></pre>
  
  <p>When I try to deserialze the above Yaml,I don't get any error.</p>
  
  <p>But when I change my Yaml to something like below, it doensot know about the tag Foo.</p>
  
  <pre><code>HeadType:
    - Bar: 0 
      Foo: FooTest
  </code></pre>
  
  <p>Is there a way I can achieve this? I have tried the below which also doesnot work:</p>
  
  <pre><code>HeadType:
    FooType:
      - Bar: 0
        Foo: FooTest
  </code></pre>
  
  <p>I am using Yaml dot net serialization "YamlDotNet.Serialization" and this is how the serialization is working:</p>
  
  <pre><code>    Deserializer deserializer = new Deserializer();
      var result = deserializer.Deserialize&lt;RootType&gt;(yamlInput1);
  </code></pre>
  
  <p>where Root is the class containing the HeadType.</p>