阅读背景:

C#反射按名称获取字段或属性

来源:互联网 

Is there a way to supply a name to a function that then returns the value of either the field or property on a given object with that name? I tried to work around it with the null-coalesce operator, but apparently that doesn't like different types (which is also a bit weird to me because null is null). I could separate it it out into if nulls, but there has to be a better way to do this. Here is my function, and the two lines with Is there a way to supply a name to a function t




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: