I have a structure like.
An interface
interface ITest
{
}
class implementing that interface
class Test : ITest
{
}
One class with parametrized constructor, and M1 method
class WithConstructor
{
public WithConstructor(ITest test)
{
}
public void M1()
{
System.Web.HttpContext.Current.Session["view"] = test;
}
}
class Test
creates it's object and calls it's M1
method as below.
WithConstructor wc = new WithConstructor(this);
wc.M1();
but it gives me error
Type 'X' in Assembly 'Y, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.
So I marked class Test
serializable using [Serializable]
but still the same error. How can I get rid oof it?