generic base class that implements interface

asp.net, c#, generics

Solution

Your question isn't totally clear to me, but couldn't you just do:

public abstract class BasePage<T> : Page, IBasePage where T : class { }

Problem

How can I declare my Basepage class in an asp.net webforms project to also implement IBasePage? ``` public abstract class BasePage<T> : Page where T : class { } ``` and the interface ``` public interface IBasePage { UserProfile UserProfile { get;} bool IsStreamingAdmin {get;} int? EmplId {get;} } ``` my ultimate goal is to be able to write code this like: ``` IBasePage page = HttpContext.Current.Handler as IBasePage; if (page.IsStreamingAdmin) { //do something here.... } ```

Original source