These v19 docs are archived 🔒.
Go to the
latest docs home
or try if
this exact page is available
in the latest docs.
CreateInstance(...) Command
If you have external code you want to import you can use CreateInstance.
⚡ The official API docs eg. on Razor14.
Important
In RazorPro, ApiPro and CodePro we use GetCode(...)
instead of CreateInstance(...)
.

Discover More in the Razor Tutorials
We have an rich series of Razor tutorials. You should really check them out 👍.
Example
@inherits Custom.Hybrid.Razor12
@{
var helper = CreateInstance("_helpers.cshtml");
var businessLogic = CreateInstance("BusinessLogic.cs");
}
@helper.ShowIntroduction
<div>
@businessLogic.CalculateSecretHash()
</div>
The code you will import is either another Razor page (_*.cshtml
) or a C# code file (*.cs
).
Also Read
- Tutorial: Reuse Shared Code
- Apps Catalog - we suggest you check out some apps - almost all use this.
History
- General Tokens introduced in 2sxc 8.0
- Added extra security switch in 2sxc 9.32