while (!dead) learn();

// a virtuous cycle

  • Thoughts
  • Intro
  • Resume

Co(ntra)variantly (In)valid

February 04, 2016 by Chris Ammerman

Sometimes I have a problem and I think to myself, "I'll solve this with generic constraints and variance."

Now I have an

ISolutionFactory<in TProblem, out TSolution>
where TProblem : class, IProblem
where TSolution : class, ISolution

...but no one can figure out how to use it without getting "Invalid variance" errors from the compiler.

February 04, 2016 /Chris Ammerman
  • Newer
  • Older

Powered by Squarespace