microsoft / DesktopBridgeToUWP-Samples

This repo contains the samples that demonstrate the usage patterns for the Desktop Conversion extensions.
MIT License
494 stars 272 forks source link

Unclear code in NorthwindSample/NorthwindCent/UwaClient/App.xaml.cs #96

Closed davidboschwitz closed 4 years ago

davidboschwitz commented 4 years ago

Is there a case where this if statement would return false? If details (aka args.TaskInstance.TriggerDetails) was null, it should return false in the if statement on line 55.

If so, including this if statement is unnecessary and I think it leads people to create code that misuses the is operator.

ptorr-msft commented 4 years ago

Your analysis is correct; the code could just move to the new pattern-matching is operator. I will see if we can fix this. (I decided not to use pattern-matching since the code in the repo is old - it targets the 14393 SDK - and pattern-matching is a new-ish feature. I just used as and a null check.)

Can you elaborate on how it causes people to misuse the is operator?