我为我的控件添加了设计器支持。
当我像下面这样设置属性值时,我得到了以下异常。
visibleColumn.Properties"PropertyName".SetValue(Value);colStyle = var
上面的代码同样适用于VS2010项目
但是它显示了VS2008项目的以下异常
InnerException: System.Reflection.AmbiguousMatchException Message=“找到不明确的匹配。”Source="mscorlib“
发布于 2010-09-27 21:33:39
这只是一个胡乱猜测,但这可能是由于派生类具有隐藏基类实现的属性,从而混淆了反射机制。
如果你使用GetType().GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly).SetValue(target, value, null),它可能会解决这个问题。
https://stackoverflow.com/questions/2427439
复制相似问题