如何.NetStandard2下面寫代碼,因此它不會返回null
?的typeof(System.Net.WebUtility).GetMethod返回`null`爲.NetStandard2(正常工作與.NetFramework4.6.1)
它正常工作與.NetFramework4.6.1
MethodInfo method = typeof(System.Net.WebUtility).GetMethod(nameof(System.Net.WebUtility.UrlEncode),
BindingFlags.Static | BindingFlags.NonPublic,
null,
new[]
{
typeof(byte[]),
typeof(int),
typeof(int)
},
null);
尋找this line是準確的,但一個是.NetFramework4.7,找不到System.Net.WebUtility
源CoreFx都沒有。
我的隨機猜測是,.NetStandard和Framework之間的參數是不同的? – CShark
請解釋你爲什麼投票! – cilerler
@CShark遺憾的是無法在[CoreFx](https://github.com/dotnet/corefx/tree/master/src)中找到'System.Net.WebUtility',但引用有簽名。 – cilerler