C# Reflection exception Method not found

C# Reflection exception Method not found

 

Ok I figured it out. The server has Microsft .NET 4.0 installed and I have .NET 4.5.

In the .NET 4.5 there's a new overload for PropertyInfo.GetValue method - it's PropertyInfo.GetValue(object obj) since in 4.0 there is only PropertyInfo.GetValue(object obj, object[] indexer)

I just had to replace:

OptionSetValue skillLevel = (OptionSetValue)optionSetsProperty.GetValue(fse); //4.5

with

OptionSetValue skillLevel = (OptionSetValue)optionSetsProperty.GetValue(fse, null); //4.0

worked like a charm!

posted @ 2018-07-13 16:43  youguess  阅读(261)  评论(0编辑  收藏  举报