I'm not new to C#, but I have found a behavior that is a little puzzling.
I have an interface
public interface IApplicationPage
{
Person ThePerson { get; set; }
Application Application { get; set; }
}
I implement the interface on a page
public partial class tripapplication2 : System.Web.UI.Page, IApplicationPage
{
Person IApplicationPage.ThePerson { get; set; }
Application IApplicationPage.IApplicationPage.Application { get; set; }
}
However, when I attempt to reference ThePerson in the page itself I need to jump through hoops. For example.
1) ThePerson.Birthday
Gives an error saying "The name 'ThePerson' does not exist in the current context."
2) ((IMissionTripApplicationPage)this).ThePerson.Birthday
This works, but it looks awful.
Is there a better way to reference the implemented properties?