stream doesn't work!

(sorry about message below. I accidentially pushed return...)

OK. So I have made a DLL-file by choosing Class Library in New Project -> C# projects...
I've put in some variables (int, string, ArrayList...) and then Build Solution.

(the variables are assigned private but with get/set, so they are actually public)

All worked well when I made my classes in the program. I could use the . to get visuals of what variables my class library contained.

But when I try to send it to the server side it can't be done!!
I get contact with server side with the tcpClient...

tcpClient = new TcpClient(ip, port);
mStream = tcpClient.GetStream();
listenThread = new Thread(new ThreadStart(listen));

this works fine! but the next...

(Object object = new Object(); //my class library)

mFormatter.Serialize(mStream, object); //send object to server

(I have added references on both client and server side!)

exception i get:
An unhandled exception of type 'System.Runtime.Serialization.SerializationException' occurred in mscorlib.dll

Additional information: The type Protokoll.NeoProtokoll in Assembly Protokoll, Version=1.0.1238.35808, Culture=neutral, PublicKeyToken=null is not marked as serializable.

does anybody know how to serialize my object??


  • write as follows in the class library
    [Serializable()] should be typed just above the constructor

    public class Class1()
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion