i am aware of nested class. how could i design my nested class in such way that out side of parent class of nested class no one will be able to access nested class like instance create etc because i want the child class will be private. i want to expose my child class property, method everything by parent class property or method. please guide me to write the code for such kind of nested class. thanks
public class Person
{
private string _firstName;
private string _lastName;
private DateTime _birthday;
//...
public class FirstNameComparer : IComparer<Person>
{
public int Compare(Person x, Person y)
{
return x._firstName.CompareTo(y._lastName);
}
}
}
Mark the internal class as
privateinstead ofpublic.