Nested classes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Barguast

    Nested classes

    This might sound a silly question, but is it possible to nest a class without
    actually including the implementation of that class within the parent class?
    If possible, I'd prefer to have the nested class implemented in it's own .cs
    file as this makes it easier to navigate my code and reduces the amount of
    identation.

    Can it be done?
  • Mattias Sjögren

    #2
    Re: Nested classes

    [color=blue]
    >Can it be done?[/color]

    In v2 it can sort of be done thanks to partial classes. Not in
    previous versions.



    Mattias

    --
    Mattias Sjögren [MVP] mattias @ mvps.org
    http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
    Please reply only to the newsgroup.

    Comment

    • Jon Skeet [C# MVP]

      #3
      Re: Nested classes

      Barguast <ItsLikeMadeUpN Stuff@Email.com > wrote:[color=blue]
      > This might sound a silly question, but is it possible to nest a class without
      > actually including the implementation of that class within the parent class?
      > If possible, I'd prefer to have the nested class implemented in it's own .cs
      > file as this makes it easier to navigate my code and reduces the amount of
      > identation.
      >
      > Can it be done?[/color]

      No, I don't believe so.

      --
      Jon Skeet - <skeet@pobox.co m>
      Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

      If replying to the group, please do not mail me too

      Comment

      • Barguast

        #4
        Re: Nested classes

        I had a brief read up of partial classes
        (http://www.devx.com/dotnet/Article/22603) and it does seem to be what I'm
        after. It's just a shame I can't use them yet :(

        "Mattias Sjögren" wrote:
        [color=blue]
        >[color=green]
        > >Can it be done?[/color]
        >
        > In v2 it can sort of be done thanks to partial classes. Not in
        > previous versions.
        >
        >
        >
        > Mattias
        >
        > --
        > Mattias Sjögren [MVP] mattias @ mvps.org
        > http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
        > Please reply only to the newsgroup.
        >[/color]

        Comment

        Working...