Consider the following Student
defintion:
public class Student
{
public Guid Id {get; set;}
public String FirstName {get; set;}
public S
I don't know what kind of serialization are you talking about. But if you use the BinaryFormatter, the way to go is to make the Student class implement the ISerializable.
Then, you can do something like:
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("Id", Id);
if (SomeCondition)
{
info.AddValue("FirstName", FirstName);
info.AddValue("LastName", LastName);
}
}
Where SomeCondition may use a static (or thread-static) variable or some information inside the StreamingContext.