SharePoint 2013: Custom field client side rendering using JSLink

SharePoint 2013 has introduced client side rendering to render SharePoint fields. When developing custom fields, the JSLink property of the field can be overriden to refer to the custom JavaScript file. Suppose, you want to override default rendering of the field in the Display form. The follwing code shows how to do that:

//Point to  js file.
private const string JSLinkUrl = "/_layouts/15/NY.Autocomplete.LookupField/JS/customCSR.js";
public override string JSLink
        if (SPContext.Current.FormContext.FormMode != SPControlMode.Display)
            return base.JSLink; 
            return JSLinkUrl;   
        base.JSLink = value;

The code above checks the current mode based on which it determines whether to use default rendering or custom rendering.
The SPControlMode is an enum and has following values:
Invalid  - Used for View
Display  - Used for Display Form
Edit  - Used for Edit Form
New  - Used for New Form