Converting instances to byte[]

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi,

I have the following class, and I will be creating instances of it to
transfer it over a networkstream. Now I need to convert instances p1,
p2 and p3 to byte[].

How can I do this?

Can someone help me out
Thanks in Advance

Person p1 = ("MyName", "MySurname");
Person p2 = ("MySurname");
Person p3 = ("MyName");



public class Person
{
private string name, surname;

public Person(){}
public Person(string n) {Name = n;}
public Person(string s) {Surname = s;}
public Person(string n, string s)
{
Name= n;
Surname = s;
}

public string Name
{
set {name = value;}
get { return name;}
}

public string Surname
{
set {surname = value;}
get {return surname;}
}
}

.



Relevant Pages

  • Re: ASP.NET Data Access Problem
    ... If you have an employee class, you can add a FullName get property, and ... method which returns names as Surname, ... public string FirstName ... public string FullName ...
    (microsoft.public.dotnet.framework.aspnet)
  • How can I get a propertydescriptor directly
    ... public string surname... ... but how can i get the propertydescriptor directly (without the name ...
    (microsoft.public.dotnet.languages.csharp)