Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>ts-to-csharpNew to Visual Studio Code? Get it now.
ts-to-csharp

ts-to-csharp

Box-Of-Hats

|
8,892 installs
| (4) | Free
Convert typescript to c#
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

TS to CSharp

Convert typescript interfaces and classes to CSharp classes.

Get it on the VSCode Marketplace

Simply select your typescript interfaces and call the command TS => CS: Generate classes from interfaces.

interface MyTypescriptInterface {
    propOne: any;
    propTwo: string;
    propThree: number[];
    propFour: boolean;
}

class AnActualClass {
    aProperty: string;
}

interface AnotherTypescriptInterface {
    nestedObjectsInAList: MyTypescriptInterface[];
    recursiveObject: AnotherTypescriptInterface;
    isReallyCool: boolean;
}

Will be converted to

public class MyTypescriptInterface {

    [JsonProperty("propOne")]
    public object PropOne;

    [JsonProperty("propTwo")]
    public string PropTwo;

    [JsonProperty("propThree")]
    public IEnumerable<int> PropThree;

    [JsonProperty("propFour")]
    public bool PropFour;

}

public class AnActualClass {

    [JsonProperty("aProperty")]
    public string AProperty;

}

public class AnotherTypescriptInterface {

    [JsonProperty("nestedObjectsInAList")]
    public IEnumerable<MyTypescriptInterface> NestedObjectsInAList;

    [JsonProperty("recursiveObject")]
    public AnotherTypescriptInterface RecursiveObject;

    [JsonProperty("isReallyCool")]
    public bool IsReallyCool;

}

Commands

Command Description
TS => CS: Generate classes from interfaces Generate CSharp classes from the current selected Typescript interfaces or classes
TS => CS: Generate classes from exported interfaces Generate CSharp classes from the current selected Typescript interfaces; only including exported interfaces or classes
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft