Re: Nested class in component

From: Nicholas Paldino [.NET/C# MVP] (mvp_at_spam.guard.caspershouse.com)
Date: 11/11/04


Date: Thu, 11 Nov 2004 10:59:49 -0500

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.

-- 
               - Nicholas Paldino [.NET/C# MVP]
               - mvp@spam.guard.caspershouse.com
"Edward Diener" <diener@ORsoftware.com> wrote in message 
news:uDg0TZAyEHA.2200@TK2MSFTNGP09.phx.gbl...
>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 ?
>
> 


Relevant Pages

  • RE: Adding namespaces to code behind automatically (C#)
    ... The VS.NET IDE will compare the value you set for the declaration of the ... As for the denpendent assemblies reference, ... it to the component class via the "ToolboxItem" attribute, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: private array member still public...?
    ... class that has to exectute another member function. ... If I nest it so the indexer works, I can't reference the class function SetBounds.... ... As long as the nested class keeps a reference to the containing class, it should be able to call whatever method you need it to. ... Alternatively would be for the nested class to declare an event that's raised when the indexer's setter is called. ...
    (microsoft.public.dotnet.framework)
  • Nested class in component
    ... I want to create a nested class within my component class. ... will have public properties. ... with my component class holding a value variable for it. ... with my component class holding a reference variable for it. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How does a nested class reference its containing class.
    ... >> I need some quick advice. ... >> I just need to reference a containing class from the nested class. ... >> public MiniClass{ ...
    (microsoft.public.dotnet.languages.csharp)
  • How does a nested class reference its containing class.
    ... I just need to reference a containing class from the nested class. ... familiar with Java but C# is proving tricky. ...
    (microsoft.public.dotnet.languages.csharp)

Loading