ProjectExodus
Transpiler from C# to Kotlin.
Install / Use
/learn @rogeralsing/ProjectExodusREADME
ProjectExodus
Transpiler from C# to Kotlin.
Requires the .NET 9 SDK.
Very early pre alpha
Usage
The transpiler expects the path to a C# solution and an output directory for the generated Kotlin files.
dotnet run --project src/CsToKotlinTranspiler -- <solution.sln> <output-directory>
You may also provide the paths via environment variables:
export CS2KOTLIN_SRC=/path/to/solution.sln
export CS2KOTLIN_OUT=./kotlinOutput
dotnet run --project src/CsToKotlinTranspiler
If neither arguments nor environment variables are supplied, the tool uses default paths.
Single-file mode
To transpile a single C# file and print the syntax-highlighted Kotlin directly to the console, use the companion CLI:
dotnet run --project src/CsToKotlinCli -- <path-to-file.cs>
Run the command with -h to show its built-in help text. The CLI uses Spectre.Console for colorful output.
Demo:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication3
{
class Example
{
public void Main()
{
var i = 1.ToString();
var res = Console.ReadLine();
Console.WriteLine("You wrote " + res);
}
public void Conditionals()
{
var x = 1 > 2 ? "a" : "b";
}
public string Arrays(string[] strings)
{
if (strings == null)
{
return "null";
}
var x = "";
foreach (var s in strings)
{
x += "," + s;
}
return x;
}
public void Linq()
{
int[] ints = {1, 2, 3, 4, 5, 6, 7, 8};
var big = ints.Where(i => i > 4).Select(i => i*2).ToList();
}
public void Delegates()
{
Action<int, string> del = (a, b) =>
{
Console.WriteLine("{0} {1}", a, b);
};
Func<int, string> del2 = a => "hello" + a;
InvokeIt(del);
}
private void InvokeIt(Action<int, string> del)
{
del(1, "hello");
}
}
}
Gets transpiled into
package consoleapplication3
class Example {
fun main () : Unit {
var i : String = 1.toString()
var res : String = readLine()
println("You wrote " + res)
}
fun conditionals () : Unit {
var x : String = if (1 > 2) "a" else "b"
}
fun arrays (strings : Array<String>) : String {
if (strings == null) {
return "null"
}
var x : String = ""
for(s in strings) {
x += "," + s
}
return x
}
fun linq () : Unit {
var ints : Array<Int> = arrayOf(1, 2, 3, 4, 5, 6, 7, 8)
var big : List<Int> = ints.filter{it > 4}.map{it * 2}.toList()
}
fun delegates () : Unit {
var del : (Int, String) -> Unit = {a, b ->
println("{0} {1}", a, b)
}
var del2 : (Int) -> String = {a -> "hello" + a}
invokeIt(del)
}
fun invokeIt (del : (Int, String) -> Unit) : Unit {
del(1, "hello")
}
}
Related Skills
node-connect
349.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
