Click here to Skip to main content
15,895,084 members
Home / Discussions / C#
   

C#

 
GeneralRe: AutoScroll not working Pin
printscreen1234531-May-06 16:54
printscreen1234531-May-06 16:54 
AnswerRe: AutoScroll not working Pin
Guffa31-May-06 5:58
Guffa31-May-06 5:58 
GeneralRe: AutoScroll not working Pin
printscreen123452-Jun-06 23:38
printscreen123452-Jun-06 23:38 
QuestionList of Messages ?? Pin
suguimoto31-May-06 5:00
suguimoto31-May-06 5:00 
AnswerRe: List of Messages ?? Pin
stancrm31-May-06 5:13
stancrm31-May-06 5:13 
GeneralRe: List of Messages ?? Pin
suguimoto31-May-06 5:15
suguimoto31-May-06 5:15 
GeneralRe: List of Messages ?? Pin
suguimoto31-May-06 5:44
suguimoto31-May-06 5:44 
QuestionXML Serialization of CollectionBase derived classes [modified] Pin
FunkyBeerMonster31-May-06 4:58
FunkyBeerMonster31-May-06 4:58 
Hi there!

I am having trouble with Serializing my classes into an XML file.

My classes are as follows:

**************
public class Class1 : CollectionBase
{
public Class1()
{
Class2 newClass = new Class2();
this.List.Add(newClass);
}

public Class2 this[int i]
{
get{return (Class2)List[i];}
}

public void Add(Class2 C)
{
this.List.Add(C);
}
}


public class Class2 : CollectionBase
{
public Class2()
{
this.List.Add("Hello");
}

public string this[int i]
{
get{return (string)this.List[i];}
}

public void Add(string S)
{
this.List.Add(S);
}
}
**************

Now they do serialize, however they do not serialize as I need them. The result looks like [I removed the namespace bits...]>

<?xml version="1.0" encoding="utf-16"?>
<ArrayOfArrayOfString ... >
<ArrayOfString>
<string>Hello</string>
</ArrayOfString>
</ArrayOfArrayOfString>


I need the names to be more user friendly instead of ArrayOfArrayOf... etc. A further issue I have is that my actual application consists of >

Class1 : CollectionBase
contains Elements of Class2
Class2 : CollectionBase
contains Elements of Class3
Class3 : CollectionBase
contains Elements of Class4
Class4

I want the serialization to NOT include the Class4 elements of Class3 however it does and I can't find a way to stop it?!

Does anyone have any ideas on how to correct this?

Many thanks,
Tom.


-- modified at 10:58 Wednesday 31st May, 2006
AnswerRe: XML Serialization of CollectionBase derived classes Pin
Dustin Metzgar31-May-06 5:29
Dustin Metzgar31-May-06 5:29 
GeneralRe: XML Serialization of CollectionBase derived classes Pin
Dustin Metzgar31-May-06 5:30
Dustin Metzgar31-May-06 5:30 
GeneralRe: XML Serialization of CollectionBase derived classes Pin
FunkyBeerMonster31-May-06 5:36
FunkyBeerMonster31-May-06 5:36 
GeneralRe: XML Serialization of CollectionBase derived classes Pin
Dustin Metzgar31-May-06 5:54
Dustin Metzgar31-May-06 5:54 
GeneralRe: XML Serialization of CollectionBase derived classes Pin
FunkyBeerMonster31-May-06 21:22
FunkyBeerMonster31-May-06 21:22 
GeneralRe: XML Serialization of CollectionBase derived classes Pin
leppie31-May-06 6:17
leppie31-May-06 6:17 
GeneralRe: XML Serialization of CollectionBase derived classes Pin
FunkyBeerMonster31-May-06 21:23
FunkyBeerMonster31-May-06 21:23 
GeneralRe: XML Serialization of CollectionBase derived classes Pin
leppie31-May-06 21:42
leppie31-May-06 21:42 
GeneralRe: XML Serialization of CollectionBase derived classes Pin
FunkyBeerMonster31-May-06 21:44
FunkyBeerMonster31-May-06 21:44 
GeneralRe: XML Serialization of CollectionBase derived classes Pin
leppie31-May-06 22:02
leppie31-May-06 22:02 
AnswerRe: XML Serialization of CollectionBase derived classes [modified] Pin
leppie31-May-06 22:05
leppie31-May-06 22:05 
GeneralRe: XML Serialization of CollectionBase derived classes [modified] Pin
FunkyBeerMonster1-Jun-06 21:14
FunkyBeerMonster1-Jun-06 21:14 
Questionhow do i get datagridview cell value ? help... Pin
cmpeng3431-May-06 4:47
cmpeng3431-May-06 4:47 
AnswerRe: how do i get datagridview cell value ? help... Pin
Larantz1-Jun-06 10:09
Larantz1-Jun-06 10:09 
Questionstatic method calling a non static Pin
PaulaM31-May-06 3:59
PaulaM31-May-06 3:59 
AnswerRe: static method calling a non static Pin
led mike31-May-06 4:50
led mike31-May-06 4:50 
AnswerRe: static method calling a non static Pin
Wjousts31-May-06 4:53
Wjousts31-May-06 4:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.