Table of Contents

CreateInstance(...) Command

If you have external code you want to import you can use CreateInstance.

⚡ The official API docs eg. on Razor14.


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 👍.


@inherits Custom.Hybrid.Razor12
  var helper = CreateInstance("_helpers.cshtml");
  var businessLogic = CreateInstance("BusinessLogic.cs");



The code you will import is either another Razor page (_*.cshtml) or a C# code file (*.cs).

Also Read


  1. General Tokens introduced in 2sxc 8.0
  2. Added extra security switch in 2sxc 9.32