I have forked HtmlAgilityPack to my github and clone it to my visual studio.
The HtmlAgilityPack targets .NetFramework 2.0 and HtmlAgilityPack.NetStandard targets .NetStandard 1.6
I added some reflection codes to it , for example :
public static PropertyInfo GetFirstPropertyInfo(Type t)
{
return t.GetProperties().First();
}
It gets me this error :
'Type' does not contain a definition for 'GetProperties' and no extension method 'GetProperties' accepting a first argument of type 'Type' could be found (are you missing a using directive or an assembly reference?) HtmlAgilityPack.NETStandard
After some StackOverflowing I found out I should use this code instead :
public static PropertyInfo GetFirstPropertyInfo(Type t)
{
return t.GetTypeInfo().GetProperties().First();
}
but this code gets error in .NetFramework !
'Type' does not contain a definition for 'GetTypeInfo' and no extension method 'GetTypeInfo' accepting a first argument of type 'Type' could be found (are you missing a using directive or an assembly reference?) HtmlAgilityPack
What should I do ???
Thanks.
Aucun commentaire:
Enregistrer un commentaire