C# model to the TypeScript model compiler.
-
Set TypeScriptModel annotation to class:
[TypeScriptModel(Namespace = "App")] public class Cls { public int Value { get; set; } }
If TypeScriptModelAttribute not set. the namespace is same as the class Namespace。
-
Compile to TypeScript code:
var builder = new TypeScriptModelBuilder(); builder.CacheType<Cls>(); var tscode = builderCompile();
-
Define class:
public class Cls { public int Value { get; set; } }
-
Compile to TypeScript code:
var builder = new TypeScriptModelBuilder(); builder.CacheType<Cls>(); var tscode = builder.Compile();
If TypeScriptModelAttribute not set. the namespace is same as the class Namespace。
/* Generated by TypeSharp v0.4.0.0 */
declare namespace App {
interface Cls {
value? : number;
}
}