News for hackers. Stuff that matters.
Re:C# Extension Methods Demystified by danabramov on Thursday March 28, 2013 @07:55PM (#5458423)
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.

There are no comments on this comment yet.