mrdance Posted November 26, 2003 Posted November 26, 2003 I am serializing objects to send XML over a socket. Creating a class like this and serialize it works fine for me: <MESSAGE> <FROM>Me</FROM> <TO>You</TO> <MESSAGE> And the class look something like this: Public Class MESSAGE Private _to As String Private _from As String Public Property to() As String Get Return _to End Get Set(ByVal to As String) _to = to End Set End Property Public Property from() As String Get Return _from End Get Set(ByVal from As String) _from = from End Set End Property End Class But because I'm new to OOP I need help creating a class like this. <CHATTERS> <CHATTER> <NAME>Name 1</NAME> </CHATTER> <CHATTER> <NAME>Name 2</NAME> </CHATTER> </CHATTER> That is, I want to have a collection of CHATTER in CHATTERS. I guess I have to add them with some kind of function. Does anybody have an example of how to solve this? Quote
*Experts* Bucky Posted November 26, 2003 *Experts* Posted November 26, 2003 Chatters needs to be a collection of some sort. Dim chatters As New ArrayList() Dim c1 As New Chatter() Dim c2 As New Chatter() c1.Name = "blah" c2.Name = "whatever" chatters.Add(c1) chatters.Add(c2) ' Then you can serialize the chatters class Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.