Trivial C# class with a generic parameter wouldn't compile for no apparent reason

后端 未结 7 821
夕颜
夕颜 2021-01-16 15:15

I want a generic function that would work with types that have Top, Bottom, Right and Rect read-only properties - I have

7条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-16 15:22

    Hey boy you just need this:

    Force generic interface implementation in C#

    this way you can assume later on that your WhatType instance will have Left, Bottom and so on...

提交回复
热议问题