back

by danabramov·13y ago·view on hn ↗
I use extension methods in a MonoTouch app for different purposes.

* adding useful hacks to Apple classes:

    UIView FindTitleView (this UINavigationBar bar)
    string GetDeviceName (this UIDevice device)
* keeping formatting consistent across the app:

    string FormatViewCount (this Document doc)
    string FormatCommentDate (this Comment comment)
* sometimes I really want to separate the class and some functions operating on its data, or providing useful helpers on top of this class:

    string SuggestTitle (this Document doc)
    Uri [] GetResources (this Document doc)
Because they live in different namespaces, I only see UIKit and formatting extensions in UI code, data analysis in business layer, and so on.