I want a generic function that would work with types that have Top, Bottom, Right and Rect read-only properties - I have
Generics is used for type safety. Now without any additional info about WhatType, how would the compiler know that the instance what that gets passed in will have a property Left?
You need something like this
public interface IFoo
{
int Left {get;}
}
and
internal class MyTemplate where WhatType : IFoo {