Click here to Skip to main content
15,893,594 members
Home / Discussions / C#
   

C#

 
QuestionDate Pickers with Checkboxes and Modified Rows Pin
gmhanna11-May-10 17:44
gmhanna11-May-10 17:44 
AnswerRe: Date Pickers with Checkboxes and Modified Rows Pin
Stanciu Vlad11-May-10 19:27
Stanciu Vlad11-May-10 19:27 
QuestionWhere to get started Pin
crosson11-May-10 17:09
crosson11-May-10 17:09 
AnswerRe: Where to get started Pin
Peace ON11-May-10 21:58
Peace ON11-May-10 21:58 
AnswerRe: Where to get started Pin
Richard MacCutchan11-May-10 22:27
mveRichard MacCutchan11-May-10 22:27 
AnswerRe: Where to get started Pin
crosson12-May-10 10:51
crosson12-May-10 10:51 
AnswerRe: Where to get started Pin
Ravi Sant14-Apr-11 1:22
Ravi Sant14-Apr-11 1:22 
QuestionSerialization Question Pin
Kevin Marois11-May-10 11:14
professionalKevin Marois11-May-10 11:14 
I have a series of classes that make up a hierarchy of objects. I am serializing the collection to an XML file: The top level is RuleRoot :

[Serializable] 
[XmlRoot("Rules")]
public class RuleRoot
{
    [XmlElement("Items")]
    public List<RuleGroup> Groups { get; set; }

}


Then, in Groups I have:

[Serializable] 
[XmlRoot("Group")]
public class RuleGroup
{
    [XmlAttribute("ID")]
    public int GroupID { get; set; }

    [XmlAttribute("Name")]
    public string GroupName { get; set; }
        
    [XmlAttribute("Active")]
    public bool Active { get; set; }
        
    [XmlElement("Rules")]
    public List<Rule> Rules { get; set; }
}


This all works fine. But now I want to base all of my classes off of a base class:

public abstract class _ItemBase
{
    public ItemType Type
    {
        get;
        internal set;
    }

    public int ItemId
    {
        get;
        internal set;
    }

    private _Collection<_ItemBase> _Items = new _Collection<_ItemBase>();
    public _Collection<_ItemBase> Items
    {
        get { return _Items; }
        internal set { _Items = value; }
    }
}



If I do this, then each object will inherit the Items collection, so in RuleRoot I no longer need Groups, and in RuleGroup I no longer
need Rules, and so on.

The question is, how do I then serialize this?
Everything makes sense in someone's mind

AnswerRe: Serialization Question Pin
William Winner11-May-10 11:40
William Winner11-May-10 11:40 
GeneralRe: Serialization Question Pin
Kevin Marois11-May-10 11:55
professionalKevin Marois11-May-10 11:55 
GeneralRe: Serialization Question Pin
William Winner11-May-10 12:07
William Winner11-May-10 12:07 
GeneralRe: Serialization Question Pin
Kevin Marois11-May-10 12:15
professionalKevin Marois11-May-10 12:15 
GeneralRe: Serialization Question Pin
William Winner11-May-10 12:43
William Winner11-May-10 12:43 
GeneralRe: Serialization Question Pin
Kevin Marois11-May-10 12:54
professionalKevin Marois11-May-10 12:54 
GeneralRe: Serialization Question Pin
William Winner12-May-10 6:01
William Winner12-May-10 6:01 
GeneralRe: Serialization Question Pin
Kevin Marois12-May-10 6:39
professionalKevin Marois12-May-10 6:39 
AnswerRe: Serialization Question Pin
William Winner11-May-10 12:44
William Winner11-May-10 12:44 
Questioninternal keyword, InternalsAvailableTo Pin
Ryan Minor11-May-10 8:13
Ryan Minor11-May-10 8:13 
AnswerRe: internal keyword, InternalsAvailableTo Pin
Paulo Zemek11-May-10 9:41
mvaPaulo Zemek11-May-10 9:41 
QuestionHow do I change service startup type Pin
ziopino7011-May-10 6:25
ziopino7011-May-10 6:25 
AnswerRe: How do I change service startup type Pin
#realJSOP11-May-10 6:30
mve#realJSOP11-May-10 6:30 
GeneralRe: How do I change service startup type Pin
ziopino7011-May-10 6:59
ziopino7011-May-10 6:59 
GeneralRe: How do I change service startup type Pin
PIEBALDconsult11-May-10 7:50
mvePIEBALDconsult11-May-10 7:50 
GeneralRe: How do I change service startup type Pin
Luc Pattyn11-May-10 7:54
sitebuilderLuc Pattyn11-May-10 7:54 
AnswerRe: How do I change service startup type Pin
Dimitri Witkowski11-May-10 10:01
Dimitri Witkowski11-May-10 10: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.