Nested class in component

  • Thread starter Thread starter Edward Diener
  • Start date Start date
E

Edward Diener

I want to create a nested class within my component class. The nested class
will have public properties. Naturally I want those properties to be
serialized just as those properties of my component are serialized. Should
my nested class be:

1) A struct, with my component class holding a value variable for it.
2) A class, with my component class holding a reference variable for it.

If the latter, does the nested class need to be derived from
System.ComponentModel.Component also ?
 
Edward,

The nested class can be anything you want it to be. The serialization
aspects will not really make a difference. You just have to be aware of the
semantics. If it is a reference that your class holds, and you pass the
reference around, then changes made to the object that reference points to
will be reflected in the main class. With a value type, it will be copied
upon assignment.

Hope this helps.
 
Back
Top