Question: I want to define a class inside a class.

example:

```
private class newClient
{
    public int ID { get; set; }
    public string Name{ get; set; }        

    private class ClientExtraData
    {
       public string ExtraField1 { get; set; }
       public string ExtraField2 { get; set; }
    }
}

```

now i want to access the ExtraField1 in such way:

```
newClient nclnt= new newClient();
string s=nclnt.ClientExtraData.ExtraField1;

```

Can this be done?

Answer: 
No it can't be done like that. The class is not a method, property or anything which is instanziated by the class.

It is also very bad design :-)

You could however say:

var myclass = new ClassOne.ClassTwo()
1. Make the inner class public so that it can be accessed.
2. Make the property you need to access as static (or create instance to access the field)

class newClient
 {
 public int ID { get; set; }
 public string Name { get; set; }

```
    public class ClientExtraData
    {
        public static string ExtraField1 { get { return "10"; }  }
        public string ExtraField2 { get; set; }
    }
}

```

Access code:

newClient nclnt = new newClient();
string s = newClient.ClientExtraData.ExtraField1;