471,610 Members | 1,368 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,610 software developers and data experts.

XmlSerializer with object derived from CollectionBase

I have been looking into using the MS application block for
configuration management, and I am very happy with the options it
provides. Since it stores hashtables, I decided that for configuration
data my app needs, I would create strongly typed collections for each
config type. For instance, CarCollection dervied from CollectionBase
which only accepts items of Car would be set to hashtable key "AppCars".

I am running into all kinds of hurdles trying to get the hashtable
serialized. The app block takes care of converting the hashtable to an
XmlNode collection I believe, but I am wondering what is going on with
my collection. I guess my questions would break down as this:

1. Is it recommended that XmlSerializer be used to store collection
objects that derive from CollectionBase and contain strongly typed values?

2. Are there any articles that would help me?

I have read enough to know that XmlSerializer wants a public property
"Count" of type int, and a public Indexer for the collection which has
to return the same type that Add requires, which I took care of.

Any suggestions? Seems like a reasonable thing to me..
Nov 12 '05 #1
2 1631
I do not think that the XmlSerializer supports hashtables. See this thread:

http://groups.google.com.au/groups?h...BXmlSerializer

--
Ross Donald
Rad Software
Free Regular Expression Designer @
http://www.radsoftware.com.au/web/Products/
"eastsh" <as*@forit.com> wrote in message
news:yG********************@twister.tampabay.rr.co m...
| I have been looking into using the MS application block for
| configuration management, and I am very happy with the options it
| provides. Since it stores hashtables, I decided that for configuration
| data my app needs, I would create strongly typed collections for each
| config type. For instance, CarCollection dervied from CollectionBase
| which only accepts items of Car would be set to hashtable key "AppCars".
|
| I am running into all kinds of hurdles trying to get the hashtable
| serialized. The app block takes care of converting the hashtable to an
| XmlNode collection I believe, but I am wondering what is going on with
| my collection. I guess my questions would break down as this:
|
| 1. Is it recommended that XmlSerializer be used to store collection
| objects that derive from CollectionBase and contain strongly typed values?
|
| 2. Are there any articles that would help me?
|
| I have read enough to know that XmlSerializer wants a public property
| "Count" of type int, and a public Indexer for the collection which has
| to return the same type that Add requires, which I took care of.
|
| Any suggestions? Seems like a reasonable thing to me..
Nov 12 '05 #2
I do not think that the XmlSerializer supports hashtables. See this thread:

http://groups.google.com.au/groups?h...BXmlSerializer

--
Ross Donald
Rad Software
Free Regular Expression Designer @
http://www.radsoftware.com.au/web/Products/
"eastsh" <as*@forit.com> wrote in message
news:yG********************@twister.tampabay.rr.co m...
| I have been looking into using the MS application block for
| configuration management, and I am very happy with the options it
| provides. Since it stores hashtables, I decided that for configuration
| data my app needs, I would create strongly typed collections for each
| config type. For instance, CarCollection dervied from CollectionBase
| which only accepts items of Car would be set to hashtable key "AppCars".
|
| I am running into all kinds of hurdles trying to get the hashtable
| serialized. The app block takes care of converting the hashtable to an
| XmlNode collection I believe, but I am wondering what is going on with
| my collection. I guess my questions would break down as this:
|
| 1. Is it recommended that XmlSerializer be used to store collection
| objects that derive from CollectionBase and contain strongly typed values?
|
| 2. Are there any articles that would help me?
|
| I have read enough to know that XmlSerializer wants a public property
| "Count" of type int, and a public Indexer for the collection which has
| to return the same type that Add requires, which I took care of.
|
| Any suggestions? Seems like a reasonable thing to me..
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Harris Boyce | last post: by
4 posts views Thread by Andy Neilson | last post: by
2 posts views Thread by Kent Boogaart | last post: by
3 posts views Thread by Loui Mercieca | last post: by
2 posts views Thread by bughunter | last post: by
reply views Thread by Craig Buchanan | last post: by
1 post views Thread by Phil Galey | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by CCCYYYY | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.