Mark Richman
Mark Richman

Reputation: 29710

Identifying classes to be marked as Serializable for out-of-proc session

We are attempting to go out-of-proc for session state, and need to mark the classes we intend to store in session as Serializable, of course.

Is there any way to automatically determine which classes should be marked as Serializable, without resorting to full regression testing of the site to flush them out via yellow screens?

Upvotes: 0

Views: 403

Answers (1)

dknaack
dknaack

Reputation: 60516

Check this out ;)

    [Serializable]
    public class SessionObject
    {
    }

    static void Main(string[] args)
    {
        bool isSerializable = typeof(SessionObject).GetCustomAttributes(typeof(SerializableAttribute), false).Length != 0;
    }

Upvotes: 1

Related Questions