Menu
CoddyTech
Course

C# for TypeScript Developers

Use your TypeScript experience to learn C# types, flow, methods, collections and object design. Build and test a multi-file order-processing program with compatible Mono C#.

TypeScript and C# side by side

The same program in TypeScript and in C#, from the lessons of this course.

  1. Run Your First C# Program

    TypeScript adds an erased static layer over JavaScript. C# compiles into a different runtime model with declared value/reference types and an explicit Main in this course. Do not assume a shared syntax fragment implies the same runtime contract.

    TypeScript
    1console.log("C# is ready");2export {};
    C#
    1Console.WriteLine("C# is ready");
  2. Output, Comments and Main

    TypeScript keeps JavaScript console.log and module-level statements. This C# environment uses Console.WriteLine inside a static Main and separate checked helper classes. Familiar braces and comments do not remove the need to translate the entry point and…

    TypeScript
    1console.log("Hi, " + "Mina"); // A comment2export {};
    C#
    1Console.WriteLine("Hi, " + "Mina"); // A comment
  3. Boolean Logic and Equality

    TypeScript permits JavaScript truthiness and operand-valued && even though types can narrow through the expression. C# boolean conditions require bool. An array or number cannot stand in as a bool without a comparison.

    TypeScript
    1const active: boolean = true;2console.log(20 >= 18 && active);3export {};
    C#
    1bool active = true;2Console.WriteLine((20 >= 18 && active) ? "true" : "false");
  4. Arrays and Bounds

    A TypeScript array annotation does not make a JavaScript array fixed-length or enforce index bounds at runtime. C# arrays have fixed Length and indexed access throws outside it. Use List<T> for C# growth and explicit bounds checks for endpoint logic.

    TypeScript
    1const values: number[] = [4, 6];2console.log(values.length);3export {};
    C#
    1int[] values = { 4, 6 };2Console.WriteLine(values.Length);
  5. Dictionaries and Missing Keys

    TypeScript Map.get can produce undefined. C# Dictionary indexing throws on an absent key and TryGetValue reports presence with an out result. TypeScript Record does not allocate every possible key, so a type-only dictionary assumption should not replace…

    TypeScript
    1const values = new Map<string, number>();2console.log(values.get("missing") ?? 0);3export {};
    C#
    1var values = new Dictionary<string,int>();2int count;3Console.WriteLine(values.TryGetValue("missing", out count) ? count : 0);
  6. Methods, Defaults and params

    TypeScript defaults and rest arrays resemble C# optional parameters and params arrays, but JavaScript explicit undefined activates defaults while C# has no such value. C# methods live on types, and optional argument values follow C# declaration rules.

    TypeScript
    1function total(factor: number = 2, ...values: number[]): number { return values.reduce((sum,n) => sum+n,0)*factor; }2console.log(total(3,2,4));3export {};
    C#
    1static string JoinTags(string prefix = "tags", params string[] tags) { return prefix + ":" + string.Join(",", tags); }

Syllabus

11 chapters48 lessons1 project48 challenges99 quiz questions

Start Here

1 lesson

More courses for TypeScript developers

Learn C# from another language

Frequently asked questions

Who is C# for TypeScript Developers for?

For people who already write TypeScript and want to learn C#. Each lesson starts from TypeScript you know and shows how C# does the same thing, so you skip the beginner basics.

Do I need to know C# already?

No. The course starts with your first C# program. You need TypeScript basics: variables, conditions, loops, functions and collections.

How many lessons does C# for TypeScript Developers have?

C# for TypeScript Developers contains 48 interactive lessons you can complete at your own pace.

What does C# for TypeScript Developers cover?

The course is organized into chapters covering: Start Here, C# Values and Text, Decisions and Missing Values, Loops and Sequences, and more.

Is C# for TypeScript Developers free?

Yes. Every course on Coddy is free to start. You can complete lessons in your browser without any downloads or signup.

Coddy programming languages illustration

Start C# for TypeScript Developers for free

Get started