Last week I announced a new library, TypeShape, with claims that it provides a practical way of doing generic programming in F#. I’m following up with this blog post to elaborate why I believe this to be genuinely useful, and how it could benefit the day-to-day life of the working .NET developer.
The pain of Reflection
Almost everybody who has worked with .NET will at some point need to dabble in the murky ways of reflection. Reflection is needed in scenaria where we need to access data in an indirect fashion, or where circumvention of the type system is necessary.
For example, assume that we have defined the following static method
Assume now that we would like invoke that method, with a value whose type cannot be known at compile time. In other words, we want to define a function
which takes an input of type
obj and invokes the generic method…
View original post 558 more words