Menu
CoddyTech
Course

C# for Dart Developers

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

Dart and C# side by side

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

  1. Run Your First C# Program

    Dart starts a top-level main function. This C# runner starts a static Main method on a class and compiles sibling files together. The source examples run in Dart; the task editor runs C#.

    Dart
    1
    2void main() {3print("C# is ready");4}
    C#
    1Console.WriteLine("C# is ready");
  2. Output, Comments and Main

    Dart print and C# Console.WriteLine both append a newline. Braces and // comments transfer directly. C# ordinary methods must be members of a type rather than top-level Dart functions in this Mono environment.

    Dart
    1
    2void main() {3print("Hi, " + "Mina"); // Greeting4}
    C#
    1Console.WriteLine("Hi, " + "Mina"); // A comment
  3. Boolean Logic and Equality

    Dart and C# both require boolean conditions and use &&, || and !. Neither treats an empty List as false. C# List equality normally compares references; Dart collection contents also require an explicit comparison strategy.

    Dart
    1
    2void main() {3final active = true; print(20 >= 18 && active);4}
    C#
    1bool active = true;2Console.WriteLine((20 >= 18 && active) ? "true" : "false");
  4. Arrays and Bounds

    Dart List literals are normally growable, unlike fixed-length C# arrays. C# List<T> is the closer growable counterpart. Dart List.filled can be fixed-length; choose the target collection based on resizing needs, not bracket syntax.

    Dart
    1
    2void main() {3final values = <int>[4,6]; values.add(8); print(values.length);4}
    C#
    1int[] values = { 4, 6 };2Console.WriteLine(values.Length);
  5. Dictionaries and Missing Keys

    Dart Map lookup returns a nullable value, so ?? often supplies a default. C# Dictionary indexers throw for missing keys; TryGetValue returns a separate presence bool. With nullable map values, Dart containsKey distinguishes missing from stored null.

    Dart
    1
    2void main() {3final counts = <String,int>{}; print(counts["missing"] ?? 0);4}
    C#
    1var values = new Dictionary<string,int>();2int count;3Console.WriteLine(values.TryGetValue("missing", out count) ? count : 0);
  6. Methods, Defaults and params

    Dart optional named arguments use braces and callers write name: value. C# optional parameters and named calls are similar in purpose, but params collects trailing arguments into an array. Dart has no equivalent variadic parameter declaration; use a…

    Dart
    1int total(List<int> values, {int factor = 2}) => values.fold(0,(a,b)=>a+b) * factor;2void main() {3print(total([2,4], factor: 3));4}
    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 Dart developers

Learn C# from another language

Frequently asked questions

Who is C# for Dart Developers for?

For people who already write Dart and want to learn C#. Each lesson starts from Dart 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 Dart basics: variables, conditions, loops, functions and collections.

How many lessons does C# for Dart Developers have?

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

What does C# for Dart 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 Dart 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 Dart Developers for free

Get started