我想在提取方法中提取出此處的常見代碼模式,但無法找到Presenter類型的正確類型。任何幫助?如何在此處提取代碼重複?
public bool CanGotoHome
{
get { return !(CurrentPresenter is IHomePresenter) && IsLoggedIn; }
}
public bool CanGotoImportanceOfAimsAndObjectives
{
get { return !(CurrentPresenter is IImportanceOfAimsAndObjectivesPresenter) && IsLoggedIn; }
}
public bool CanGotoGotoAimsAndObjectives
{
get { return !(CurrentPresenter is IAimsAndObjectivesPresenter) && IsLoggedIn; }
}
btw,我會先檢查IsLoggedIn,然後才檢查類型。 – abatishchev 2009-12-14 05:26:24