Click here to Skip to main content
15,891,473 members
Home / Discussions / C#
   

C#

 
Questionhow to insert a new node in a tree view programatically? Pin
samidhas3-Feb-08 23:32
samidhas3-Feb-08 23:32 
GeneralRe: how to insert a new node in a tree view programatically? Pin
Mircea Puiu3-Feb-08 23:45
Mircea Puiu3-Feb-08 23:45 
GeneralWebParts.. Pin
razanabanu3-Feb-08 23:24
razanabanu3-Feb-08 23:24 
GeneralRe: WebParts.. Pin
_tasleem4-Feb-08 1:27
_tasleem4-Feb-08 1:27 
QuestionHow to capture Pc remote control keycodes? Pin
dudiba3-Feb-08 23:18
dudiba3-Feb-08 23:18 
GeneralEdit Data in DataGridView Control Pin
D i x y3-Feb-08 22:50
D i x y3-Feb-08 22:50 
GeneralRe: Edit Data in DataGridView Control Pin
Mircea Puiu3-Feb-08 23:50
Mircea Puiu3-Feb-08 23:50 
QuestionElement name of serialized List<t></t> Pin
Nathan Gloyn3-Feb-08 22:45
Nathan Gloyn3-Feb-08 22:45 
I'm starting to pull my hair out and hope somebody can help stop me from becoming bald!

I have a Class - LookupItem that uses XmlRoot attribute so that when serialized individually outputs under element named Item.

Now if I have a List<lookupitem> when I serialize it the lookup item class always serializes as LookupItem and not Item.

What I'm wanting to see is:

<Clean>
<Item>
....
</Item>
</Clean>

but all I get is:

<Clean>
<LookupItem>
....
</LookupItem>
</Clean>

The code I'm currently using to do the serialization is below, but I have tried doing serialization with extra types, XmlAttributeOverrides and still cannot get the output correct.
<br />
            XmlSerializerNamespaces ns = new XmlSerializerNamespaces();<br />
            ns.Add("", "");<br />
<br />
            XmlAttributeOverrides xao = new XmlAttributeOverrides();<br />
<br />
            XmlRootAttribute xr = new XmlRootAttribute("Clean");<br />
            XmlSerializer s = new XmlSerializer(typeof(LookupItemList));<br />
            <br />
            XmlWriterSettings settings = new XmlWriterSettings();<br />
            settings.OmitXmlDeclaration = true;<br />
<br />
            StringWriter output = new StringWriter();<br />
            XmlWriter writer = XmlWriter.Create(output, settings);<br />
<br />
            //TextWriter w = new StreamWriter();<br />
            s.Serialize(writer, Clean, ns);<br />
            writer.Close();<br />
<br />
            output.ToString();


Can anybody help me at all?
GeneralRe: Element name of serialized List Pin
TJoe4-Feb-08 1:59
TJoe4-Feb-08 1:59 
GeneralRe: Element name of serialized List Pin
Nathan Gloyn4-Feb-08 3:01
Nathan Gloyn4-Feb-08 3:01 
GeneralRe: Element name of serialized List Pin
TJoe4-Feb-08 3:08
TJoe4-Feb-08 3:08 
GeneralRe: Element name of serialized List Pin
Nathan Gloyn4-Feb-08 3:24
Nathan Gloyn4-Feb-08 3:24 
GeneralRe: Element name of serialized List Pin
TJoe4-Feb-08 3:47
TJoe4-Feb-08 3:47 
GeneralRe: Element name of serialized List Pin
Nathan Gloyn4-Feb-08 4:08
Nathan Gloyn4-Feb-08 4:08 
GeneralHitting Back button Pin
razanabanu3-Feb-08 22:35
razanabanu3-Feb-08 22:35 
GeneralRe: Hitting Back button Pin
Mircea Puiu3-Feb-08 23:55
Mircea Puiu3-Feb-08 23:55 
QuestionIs there free code for plot 3D figures? Pin
Seraph_summer3-Feb-08 21:22
Seraph_summer3-Feb-08 21:22 
AnswerRe: Is there free code for plot 3D figures? Pin
Mircea Puiu3-Feb-08 23:56
Mircea Puiu3-Feb-08 23:56 
Questionhow to read filename? Pin
samidhas3-Feb-08 21:15
samidhas3-Feb-08 21:15 
GeneralRe: how to read filename? Pin
N a v a n e e t h3-Feb-08 21:41
N a v a n e e t h3-Feb-08 21:41 
GeneralRe: how to read filename? Pin
samidhas3-Feb-08 22:41
samidhas3-Feb-08 22:41 
QuestionGiving privilege certificate to an app??? Pin
Shivaprasad3-Feb-08 20:11
Shivaprasad3-Feb-08 20:11 
QuestionPassing parameters while debugging?? Pin
Muammar©3-Feb-08 19:55
Muammar©3-Feb-08 19:55 
AnswerRe: Passing parameters while debugging?? Pin
Martin#3-Feb-08 21:46
Martin#3-Feb-08 21:46 
GeneralRe: Passing parameters while debugging?? Pin
Muammar©4-Feb-08 2:32
Muammar©4-Feb-08 2:32 

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.