私は次のことを確認しようとしています
typeof( ICollection<> ).GetTypeInfo().IsAssignableFrom( targetProperty.PropertyType.GetTypeInfo() )
に渡される引数IsAssignableFromはIList<Something>. しかし、それはfalseを返しています。
以下も false を返します。
typeof( ICollection<> ).GetTypeInfo().IsAssignableFrom( targetProperty.PropertyType.GetTypeInfo().GetGenericTypeDefinition() )
以下でもfalseを返しています。
typeof( ICollection<> ).GetTypeInfo().IsAssignableFrom( typeof(IList<>) )
後者は間違いなく true を返すべきではありませんか?
targetProperty.PropertyType任意のタイプになる可能性がある場合、どうすれば正しい結果を得ることができますか? 、List<T>、ObservableCollection<T>、ReadOnlyCollection<T>カスタム コレクション タイプなどです。