I want a generic function that would work with types that have Top
, Bottom
, Right
and Rect
read-only properties - I have
You haven't specified any conditions for the WhatType
type, so it will accept any type, and only know what every type knows, i.e. only what's defined in the Object
class.
If you want to use anything else in the type, you have to specify what it contains, which you do by specifying that it has to implement an interface or inherit from a class:
internal class MyTemplate where WhatType : BaseType {
Where BaseType
would either be an interface or a class where the Left
property is defined.