Click here to Skip to main content
15,909,897 members
Home / Discussions / C#
   

C#

 
GeneralRe: Date Pin
PIEBALDconsult4-Feb-08 13:58
mvePIEBALDconsult4-Feb-08 13:58 
GeneralRe: Date Pin
DaveyM694-Feb-08 8:14
professionalDaveyM694-Feb-08 8:14 
GeneralRe: Date Pin
snorkie4-Feb-08 8:20
professionalsnorkie4-Feb-08 8:20 
GeneralRe: Date Pin
simworld5-Feb-08 7:42
simworld5-Feb-08 7:42 
GeneralHtml table to DataTable Object Pin
Nadia Monalisa4-Feb-08 5:39
Nadia Monalisa4-Feb-08 5:39 
GeneralRe: Html table to DataTable Object Pin
Gareth H4-Feb-08 6:56
Gareth H4-Feb-08 6:56 
GeneralConvert mdf and ldf for .bak file Pin
Thaer Hamael4-Feb-08 3:05
Thaer Hamael4-Feb-08 3:05 
GeneralRe: Convert mdf and ldf for .bak file Pin
Christian Graus4-Feb-08 12:32
protectorChristian Graus4-Feb-08 12:32 
GeneralIFilter Pin
justintimberlake4-Feb-08 2:11
justintimberlake4-Feb-08 2:11 
GeneralRe: IFilter Pin
Pete O'Hanlon4-Feb-08 3:04
mvePete O'Hanlon4-Feb-08 3:04 
Questioni want to insert a new node regarding this code.but insert is not working.. Pin
samidhas4-Feb-08 0:04
samidhas4-Feb-08 0:04 
GeneralRe: i want to insert a new node regarding this code.but insert is not working.. Pin
Guffa4-Feb-08 1:21
Guffa4-Feb-08 1:21 
GeneralRe: i want to insert a new node regarding this code.but insert is not working.. Pin
samidhas4-Feb-08 4:06
samidhas4-Feb-08 4:06 
GeneralRe: i want to insert a new node regarding this code.but insert is not working.. Pin
Guffa4-Feb-08 8:58
Guffa4-Feb-08 8:58 
GeneralRe: i want to insert a new node regarding this code.but insert is not working.. Pin
samidhas4-Feb-08 18:43
samidhas4-Feb-08 18:43 
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 

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.