Skip to content

Commit abacf46

Browse files
authored
Update README.md
1 parent cff80cd commit abacf46

1 file changed

Lines changed: 24 additions & 25 deletions

File tree

README.md

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -30,47 +30,46 @@ using CSharpToJavaScript;
3030
namespace ProgramTest;
3131

3232
public 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
```
5353
test.cs
5454
```csharp
5555
namespace ProgramTest;
5656

5757
public class Test
58+
{
59+
public Test()
5860
{
59-
public Test()
60-
{
61-
Console.WriteLine("HelloWorld");
62-
}
63-
61+
Console.WriteLine("HelloWorld");
6462
}
63+
}
6564
```
6665
Above code will generate test.js file that contains:
6766
```javascript
6867
class 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

Comments
 (0)