开发者

System.Reflection.AmbiguousMatchException

I ad开发者_运维知识库ded Designer support for my control.

I got the following exception when setting the property value like below.

var colStyle = visibleColumn.Properties["PropertyName"].SetValue(Value);

The same above code works fine for VS 2010 project

but it shows the following exception for VS 2008 project

InnerException: System.Reflection.AmbiguousMatchException Message="Ambiguous match found." Source="mscorlib"


Just a wild guess, but this may be due to a derived class having a property that is hiding the base class implementation, confusing the reflection mechanism.

If you use GetType().GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly).SetValue(target, value, null) it may fix the problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜