I have the nub of the code like this:
public class OuterClass
{
public static InnerClass GetInnerClass()
{
return new InnerClass() { MyProperty =
There is no protection level for that. internal
is the tightest you can use, which is limited to files in the same assembly. If you cannot make it a constructor parameter as has been proposed, you could use an interface:
public class OuterClass
{
public static InnerClass GetInnerClass()
{
return new InnerClassImpl() { MyProperty = 1 };
}
public interface InnerClass
{
int MyProperty { get; }
}
private class InnerClassImpl : InnerClass
{
public int MyProperty { get; set; }
}
}