How can I serialize a base object if the implementing object is not Serializable?
===

I am trying to serialize a type like follows:

        public UsersPanel(UsersVM userVm)
        {
            var serialized = Serialize(userVm);
        }

        public static string Serialize(ViewModelBase instance)
        {
            var formatter = new BinaryFormatter();
            using (var stream = new MemoryStream())
            {
                formatter.Serialize(stream, instance); // breaks here
                return Convert.ToBase64String(stream.ToArray());
            }
        }

Where `UsersVM` is defined as 

    public class UsersVm : ViewModelBase {}

and `ViewModelBase` is defined as

    [Serializable]
    public class ViewModelBase {}

This is giving me the following error:

> Type 'UsersVM' is not marked as serializable.

Why is it telling me this, if I've cast the object `userVm` to `ViewModelBase` (which *is* marked as Serializable) by passing it into `Serialize(ViewModelBase instance)`?

I would have thought that passing `UsersVM` would be replaced by the base type `ViewModelBase` when passing it into the method which takes `ViewModelBase`. 

How can I serialize ViewModelBase?

