Classes... Posititve.. Nested Classes? ...Negative

Hello,
within another thread, I've learned to use the Property Class in the simplistical way...
But this is what I was able to produce:

Day1.Lunch

But if I wanted to do

Day1.Lunch.Special

how would I do it
I tried to put multiple Public Property statements within another and produce a huge mess...
Had to undo..........

I tried to read the MSDN's Nested Public Class, but no avail...
Please help me out
Is this even possible (ex. Cars.Honda.Civic.2005)

if so, please help me (explain and/or show) me the code to do this.
This is part of an important project...
Thank You!
Keehun Nam


P.S. When I mean by "showing code to do this", I mean it so that I can assign a value to:
Day.Lunch.Special with IntelliSense...... I see this so more efficient than having to rename ton of different controls all in different tabpages by their job. I could just assign the control values to variable names programmatically...

Thanx!!!!!!
Keehun

Sorry, I like small fonts...



Answer this question

Classes... Posititve.. Nested Classes? ...Negative

  • Jagatheesan

    Thankx

    And yes, I've figured that out!

    Thanks for leading...

    I just got the idea!

    Keehun



  • Chris Lyon - MS

    // I tried to put multiple Public Property statements within another and produce a huge mess...

    No, that will never work. You can nest class statements, but you can't nest properties. You can make a property which is of a type that has properties, however.

    class Day

    {

    class Lunch

    {

    public string Special;

    }

    }

    OR

    class Lunch

    {

    public string Special;

    }

    Class Day

    {

    public Lunch Lunch = new Lunch();

    }

    Yes, this is C#, but you should get the general idea.



  • Classes... Posititve.. Nested Classes? ...Negative