using System.Collections.Generic;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.ObjectFactories;
using YamlDotNet.Serialization.NamingConventions;
public static void Main()
var yamlInput = new StringReader(Document);
var deserializer = new DeserializerBuilder()
.WithTagMapping("!order", typeof(Order))
.WithTagMapping("!test", typeof(Test))
var contacts = deserializer.Deserialize<object>(yamlInput);
Console.WriteLine(contacts);
foreach (var contact in (IEnumerable<object>)contacts)
Console.WriteLine(contact.GetType().Name);
Console.WriteLine(contact.ToString());
private const string Document = @"---
Receipt: Oz-Ware Purchase Invoice
Descrip: Water Bucket (Filled)
Descrip: Water Bucket (Filled)
Road to the Emerald City.
public string Receipt { get; set; }
public DateTime Date { get; set; }
public Customer Customer { get; set; }
public List<OrderItem> Items { get; set; }
public int myproperty {get; set;}
public Address BillTo { get; set; }
public Address ShipTo { get; set; }
public string SpecialDelivery { get; set; }
public override string ToString()
public string Given { get; set; }
public string Family { get; set; }
public string PartNo { get; set; }
public string Descrip { get; set; }
public decimal Price { get; set; }
public int Quantity { get; set; }
public string Street { get; set; }
public string City { get; set; }
public string State { get; set; }
public string jo {get; set;}
public override string ToString()