I have functions in my view that is shared by several pages:
@functions { public HtmlString ModeImage(ModeEnum mode) { switch(mode) {
You could make a static helper page and put a normal static method in the page. You could then call it by writing PageName.MyMethod() anywhere, and I believe that you won't need to recompile the project.
static
PageName.MyMethod()