开发者

System.Reflection.AmbiguousMatchException

开发者 https://www.devze.com 2022-12-22 12:07 出处:网络
I ad开发者_运维知识库ded Designer support for my control. I got the following exception when setting the property value like below.

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

精彩评论

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