If a base class is marked as [Serializable] will the dervied class also be serializable? RRS feed

  • Question

  • If I derive a class from a base class that is decorated with the [Serializable] attribute, will the entire derived class be serializable or will the derived class also need to be decorated?

    For example:

    public class MyBase
       public int Id { get; set; }       
    public class MyDerived : MyBase
       public string Name { get; set; }       

    IOW, Do I also need to add [Serializable] to MyDerived or is it implied from the parent?

    • Edited by BillyM2010 Tuesday, July 10, 2012 7:26 PM
    Tuesday, July 10, 2012 7:25 PM


All replies