尝试在公共类中创建受保护的内部类的受保护内部成员会导致以下问题:
可访问性不一致:字段类型'what.Class1.ProtectedInternalClass'比字段'what.Class1.SomeDataProvider.data'更难访问
据我所知,可访问性应该是等效的.
我哪里弄错了?
起源类:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace what
{
public class Class1
{
// This class cannot be modified, is only
// here to produce a complete example.
public class PublicClass
{
public PublicClass() { }
}
protected internal class ProtectedInternalClass : PublicClass
{
public ProtectedInternalClass() { }
public void SomeExtraFunction() { }
}
public class SomeDataProvider
{
public int AnInterestingValue;
public int AnotherInterestingValue;
protected internal ProtectedInternalClass data; //<--- Occurs here.
public PublicClass …Run Code Online (Sandbox Code Playgroud)