Reference

Home > Documentation > Safe Zones


To avoid having customisations overwritten by regeneration, content can be preserved within safe zones.

For example here is some sample generated code:

    public double Seconds
    {
        get { return _Seconds; }
        set { _Seconds = value; }
    }

    public string Location
    {
        get { return _Location; }
        set { _Location = value; }
    }

Defining safe zone identifiers in main:

#safebegin = "//safe start"
#safeend = "//safe end"

And then in the generated output file, add customisations within safe zones:

    public double Seconds
    {
        get { return _Seconds; }
        set { _Seconds = value; }
    }

//safe start
    public double Hours
    {
        get { return Seconds / 3600; }
        set { Seconds = value * 3600; }
    }

    public double Minutes
    {
        get { return Seconds / 60; }
        set { Seconds = value * 60; }
    }

    public double Minutes
    {
        get { return Seconds; }
        set { Seconds = value; }
    }
//safe end
    public string Location
    {
        get { return _Location; }
        set { _Location = value; }
    }

 

When the code is regenerated, content inside the safe zones are not overwritten.