C# 转 JS 编译器 Saltarelle
jopen
12年前
这个编译器可以将 C# 代码编译成 JavaScript 代码。所以你可以使用所有 C# 的优势,例如静态类型检查,自动补全,Lambda 表达式等等。再也不会有“object does not support this property or method”错误了!
Saltarelle 兼容其他的 JavaScript 类库和框架,例如 jQuery。Saltarelle 支持 C# 4.0:
支持C# 语言特性如下:
This is a list of C# language features and whether SaltarelleCompiler supports them. If a feature is not on the list, it is most likely supported (unless it is very obscure).
- Inheritance
Supported
- Type inference
Supported
- ref/out parameters
Supported
- Generics
Supported
- Anonymous types
Supported
- Lambdas and anonymous delegates
Supported
- User-defined operators
Supported
- User-defined conversions
Supported
- Method overloading
Supported
- Constructor overloading
Supported
- Object and collection initializers
Supported
- foreach
Supported
- using statement
Supported
- Exception handling
Supported
- Named and default arguments
Supported
- C# variable capture semantics
Supported
- Always evaluate expressions left-to-right
Supported
- Properties
Supported
- Indexers
Supported
- Events
Supported
- Nullable types and lifted operators
Supported
- dynamic
Supported
- Nested types
Supported
- Query expressions
Supported
- goto/goto case/goto default
Supported
- Iterator blocks (yield)
Supported
- lock statement
Has no effect
- async
Not yet supported
- Multi-dimensional arrays
Not yet supported
- Expression trees
Not yet supported
- operator true/false
Not yet supported
- extern alias
Not yet supported
- Clipped integer type (short/byte)
Not yet supported
- checked/unchecked
Not yet supported
- User-defined value types
Not yet supported
- Pointers
No support planned