Reputation: 213
I wondering why the AppDelegate class in Xamarin.iOS is an partial class? Because I cannot find a second part to it and when I remove the "partial" keyword, the app still works?
So why Xamarin still generates this class as partial class?
Upvotes: 0
Views: 201
Reputation: 5084
The partial class here is the same reason partial classes are cool everywhere...so that code generators can maintain the automated part of the class while you can write a separate file to maintain your customizations.
Having said that, most of the doc I've seen regarding AppDelegate just has you writing straight into the gen'd code. Total speculation on my part, but I suppose the good folks at Xamarin had expected to make it something that got rebuilt over and over, but changed their minds and never implemented it that way. Problem is...now that it's partial...it'll probably stay partial...to not break developer expectations.
It's probably still good form to write your customizations in a separate file when you see gen'd partial classes. Who knows; some infrastructure piece you use in the future may take advantage of the partial class, and register it's components in its own partial class file.
Upvotes: 1