Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

反射方式调用属性设置值报错 #709

Closed
wuxiongbin opened this issue Jun 17, 2022 · 0 comments
Closed

反射方式调用属性设置值报错 #709

wuxiongbin opened this issue Jun 17, 2022 · 0 comments

Comments

@wuxiongbin
Copy link

namespace TestCases
{
public class HotBehaviour
{
public T csObj { get; protected set; }
}

class XX : HotBehaviour<int>
{

}

class Test06
{
    public static void TestForEach()
    {
        XX x = new XX();
        var type = typeof(XX);
        var value = type.GetProperty("csObj").GetValue(x);
        type.GetProperty("csObj").SetValue(x, 11);
    }
}

}

测试代码,必现

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant