List extension
I created this extesion
In my test, to string worked
But when I try with int, not worked
Show to me:
Argument type 'null' is not assignable to parameter type 'int'
What I did wrong?2 Replies
T?
on a generic method, by default, does not let you pass null
for structs
you need to write two generic methods
the code can be identical for both in this case
the where T : struct
one will use the special Nullable<T>
type that allows you to pass nulloh nice! Is there some doc to I see more details about generics?
Thank you