Compare class syntax across programming languages: Typescript, C#, Dart

  • Interface
  • Enum
  • Class
  • Derived class (deriving from & implementing the previously mentioned class and interface)


General info

Typescript code example

Typescript syntax

Typescript remarks

constructor(protected fuelType: FuelType)
constructor() {


General info

C# code example

C# syntax

C# remarks

DateTime buildDate {
get { return _buildDate; }
set { _buildDate = value; }
public Car() : base() { }


General info

Dart code example

Dart syntax

Dart remarks

  • Optional parameters should be placed between brackets {}
  • If the constructor has no implementation, then use semi-column ‘;’ instead of brackets ‘{}’
  • call parent constructor with super(…)
Car(this.brand,{ this.hasGears = true }) : super(4);




Partner at Appdnd: agency specialized in App Design & Development. Interests: technology, startups, travel & watersports.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store