Execute C# code instantly in a secure, isolated sandbox. No setup, no installs — just write and run.
C# is Microsoft's flagship language and now fully cross-platform via .NET 9. Top-level statements, records, pattern matching, and LINQ make it one of the most productive languages for everything from web APIs to game development with Unity.
Our sandbox runs .NET 9 with the BCL. dotnet add package is available in Pro+ sessions.
Open a session once, then call execute repeatedly — variables, files, and installed packages persist between runs. Perfect for code interpreters and REPL-style agents.
# 1. Create a session curl -X POST https://api.sandboxapi.dev/v1/sessions \ -H "X-RapidAPI-Key: $KEY" \ -d '{"language":"csharp","idle_ttl":300}' # → {"id":"sess_abc","language":"csharp",...} # 2. Execute — first call curl -X POST https://api.sandboxapi.dev/v1/sessions/sess_abc/execute \ -H "X-RapidAPI-Key: $KEY" \ -d '{"code":"int x = 42; Console.WriteLine(x);"}' # 3. Execute again — state carries over curl -X POST https://api.sandboxapi.dev/v1/sessions/sess_abc/execute \ -H "X-RapidAPI-Key: $KEY" \ -d '{"code":"// Note: C# is compiled — sessions persist files, not REPL state"}'
Note: C# is a compiled language. Sessions persist installed packages and files on disk, but variable state does not carry between calls. Use multi-file submissions or write intermediate state to disk.
Integrate secure code execution into your own apps with our REST API. Free tier includes 500 executions per month.
Get API Key on RapidAPI