有人可以解释一下,为什么 System.Type 中的 GetProperty 方法对于声明为“内部”但适用于“公共”的属性返回 null。
internal class Test{
public string ALocal { get; set; }
internal string SLocal { get; set; }}
var test = new Test();
var testType = test.GetType();
var aProp = testType.GetProperty("ALocal"); => returns string Type
var sProp = testType.GetProperty("SLocal"); => returns null
Run Code Online (Sandbox Code Playgroud)
我了解内部或公共修饰符之间的差异。