By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,667 Members | 1,740 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,667 IT Pros & Developers. It's quick & easy.

Generics and attributes

P: n/a
I'm playing a little bit with 2.0 and generics.

I have two classes

public class UserCollection : Collection<User>
{
}

public class User
{
public string Name;
}

Serializing this collection with XmlSerializer brings me

<UserCollection>
<User>
<Name/>
</User>
</UserCollection>

With the attribute [XmlRoot("Users")] in front of the collection I can
modify the "UserCollection"-Tag to "Users".

But how do I modify the "User"-Tag? From 1.1 I know to somewhere put a
[XmlArrayItem("MyUser")], but where to put it in 2.0? In front of User
it doesn't work.

--
Sleepless in Berlin
W. Schwenkner
Nov 16 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.