Basic example

This is a basic example of a translation rendering Razor logic. It does nothing really usefull but shows you how to

  • add using statements
  • define functions
  • call functions
Smartsite SXML CopyCode image Copy Code
@using System
@using System.Collections.Generic
@using System.IO

@functions {

    public string Yee()
    {
        Dictionary<string, string> dict = new Dictionary<string, string>();
        dict.Add("yee", "Yippie");

        return dict["yee"];
    }

    int nothing = 0;
}

Are we happy: @Yee()!<br />
PI: @Math.PI<br />
Current directory: @Directory.Exists(Directory.GetCurrentDirectory())<br />
Simple math: @(1 + 1)<br />