CS-Script 3.20.0


Autoclass

/autoclass or /ac - generates wrapper class if the script does not define any type

In this mode the script engine automatically generates wrapper class if the script does not define any class of its own.

This feature is a light weight flavor of the Classless Scripts support. The important difference is that Autoclass support is a native (embedded) feature of the script engine and does not require any external file to work (Clssless Scripts require Alternative Compiler implemented as a separate assembly).
cscs /autoclass script.cs
     
using System;

public class ScriptClass
{
    static public void Main()
    {
        Console.WriteLine(
"Hello World!");
    }
}

Note: the /autoclass switch does not interfire with execution of normal class containing scripts.


The acceptable alternative entry point signatures are:

void main()
int main()
void main(string[] args)
int main(string[] args) 

You may find that the most convenient way of enabling the autoclass mode is from the script istelf. In oder to do so you need to place /ac argument as part of the script arguments directive at start of the script code:
 
//css_args /ac
using System;
...

See Also

Command-line interfaceClassless Scripts