@@ -30,47 +30,46 @@ using CSharpToJavaScript;
3030namespace ProgramTest ;
3131
3232public class Program
33+ {
34+ public static void Main ()
3335 {
34- public static void Main ()
36+ Assembly executingAssembly = Assembly .GetExecutingAssembly ();
37+
38+ CSTOJSOptions opt = new ()
3539 {
36- Assembly executingAssembly = Assembly .GetExecutingAssembly ();
37- CSTOJSOptions opt = new ()
40+ CustomCSNamesToJS = new List <Tuple <string , string >>()
3841 {
39- CustomCSNamesToJS = new List <Tuple <string , string >>()
40- {
41- new Tuple <string , string >(" Console" ," console" ),
42- new Tuple <string , string >(" WriteLine" , " log" )
43- },
44- OutPutFileName = " test.js"
45- };
46-
47- CSTOJS cstojs = new (executingAssembly , opt );
48- cstojs .Generate2Async (" C:\\ GitReps\\ Program\\ Program\\ CSharp\\ test.cs" );
49- }
50-
42+ new Tuple <string , string >(" Console" ," console" ),
43+ new Tuple <string , string >(" WriteLine" , " log" )
44+ },
45+ OutPutFileName = " test.js"
46+ };
47+
48+ CSTOJS cstojs = new (executingAssembly , opt );
49+ cstojs .Generate2Async (" C:\\ GitReps\\ Program\\ Program\\ CSharp\\ test.cs" );
5150 }
51+ }
5252```
5353test.cs
5454``` csharp
5555namespace ProgramTest ;
5656
5757public class Test
58+ {
59+ public Test ()
5860 {
59- public Test ()
60- {
61- Console .WriteLine (" HelloWorld" );
62- }
63-
61+ Console .WriteLine (" HelloWorld" );
6462 }
63+ }
6564```
6665Above code will generate test.js file that contains:
6766``` javascript
6867class Test
6968{
70- constructor ()
71- {
72- console .log (" HelloWorld" );
73- }
69+ constructor ()
70+ {
71+ console .log (" HelloWorld" );
72+ }
7473}
7574```
7675## Some Todos
@@ -87,6 +86,6 @@ https://github.com/TiLied/GenCSharpLib
8786## Thanks and usings
8887[ Microsoft CodeAnalysis CSharp] ( https://www.nuget.org/packages/Microsoft.CodeAnalysis.CSharp/ ) nuget package
8988
90- [ MDN-content] ( https://github.com/mdn/content ) for docs
89+ [ MDN-content] ( https://github.com/mdn/content ) for js docs
9190
9291
0 commit comments