Pattern matching on RepoItemInfo
Posted: Mon Mar 11, 2019 5:18 pm
Is it possible to perform pattern matching on RepoItemInfo objects? I'm working on a test where there might be one window or another, and I'd like to perform an action based on whichever window's RepoItemInfo is returned first. I've tried something similar to the following
but when I try to build before running, I get a compiler error telling me that the repository Instance doesn't exist in the repository type. Is there a different way to go about pattern matching?
Code: Select all
RepoItemInfo myCoolWindow = GetTheFirstActiveWindow();
if (myCoolWindow is MyProgramRepo.Instance.CoolWindow.SelfInfo)
{
// do stuff
}
else if (myCoolWindow is MyProgramRepo.Instance.FunWndow.SelfInfo)
{
// do other stuff
}