Results 1 to 2 of 2

Thread: Using XML Serialization on a List<T>

  1. #1

    Thread Starter
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Using XML Serialization on a List<T>

    I have a struct that I seralize via XML Serialization. It contains a list of KeyValuePair<T, K>. How do I serlize this via XML appropriately? All my items serialize correctly except it doesn't contain the data for my list.

    It's declared as such
    VB Code:
    1. System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<string, string>> MyList = new List<KeyValuePair<string,string>>();
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  2. #2

    Thread Starter
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: Using XML Serialization on a List<T>

    Serializing a simple List<T> works fine with XML Serialization. The problem is if I use a KeyValuePair in it. To work around this issue, I may just use a structure instead of a KeyValuePair because that would work fine.

    Though if anyone has any suggestions please let me know.
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width