I have the following code that does not compile:
public class Outer
{
public Inner MyField = new Inner(); //error here: "field type is less accessible than field"
private class Inner
{
public string Message = "Hello";
}
}
I must be able to use the class like so:
var MyObject = new Outer();
Console.WriteLine(MyObject.MyField.Message); //should output "Hello"
"Inner" must ONLY be instantiable from within "Outer", so this should NOT be allowed:
var MyObject = new Outer.Inner(); //I do not want users to be able to instantiate "Inner" directly