Inheritance

Jan 17, 2014 at 10:48 PM
Is there a way to make inheritance work? Here is a code sample.
    class Program
    {
        static void Main(string[] args)
        {
            var st = new SpecificType() { Name = "This is a test" };
            var serializer = new AvroSerializer(typeof(SpecificType));
            using (var buffer = new MemoryStream())
            {
                serializer.Serialize(st, buffer);
                buffer.Position = 0;

                var deserializer = new AvroSerializer(typeof(BaseType));
                var bt = deserializer.Deserialize<BaseType>(buffer);
                var ct = (SpecificType)bt;
            }
        }
    }
    [KnownType(typeof(SpecificType))]
    [DataContract]
    public class BaseType
    {
    }
    [DataContract]
    public class SpecificType : BaseType
    {
        [DataMember]
        public string Name { get; set; }
    }