I have a class that i need to reflect through an object properties and check values and other things. Everything seems to be working exception when i have a list and try to
The fact that int is a value type makes the difference here. According to C# spec there must be a reference or identity conversion between generic types to make types variant-convertible:
A type
Tis variance-convertible to a typeTifTis either an interface or a delegate type declared with the variant type parametersT, and for each variant type parameterXione of the following holds:
Xiis covariant and an implicit reference or identity conversion exists fromAitoBiXiis contravariant and an implicit reference or identity conversion exists fromBitoAiXiis invariant and an identity conversion exists fromAitoBi
IEnumerable is covariant, so the line I marked is important. Ai in your case is int and Bi is int. There is no reference conversion from int to object, because int is not a reference type. There is also no identity conversion between these two, because they are not the same.
I don't know the entire context of your question, but you can use non-generic IEnumerable instead of IEnumerable. They are pretty much the same. However, you might be facing an XY problem here, so it's hard to help you without knowing more about your case.