Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: