Syntax Sugar in C#

Syntax Sugar or Syntactic Sugar is a “shortcut” provided for languages to reduce the amount of code that you can write in common situations. The objective of Syntax Sugar is make the code cleaner and easier to read (is not always the case specially for beginner programmers).

Some examples of Syntax Sugar in C#

  • Arithmetic operations:
  • Increment/Decrement by 1:
  • Declare variables:
  • Negation:
  • Conditional operator:

Conclusion:

In the end it doesn’t matter how you write your code as long it is functional, but it is good to know the different ways to do that because when you work in a team it is very probable that the other members use this and you’re gonna understand it.

--

--

--

A Software Engineer passionate about game dev and interactive products with Unity. I consider video games to be the artistic expression of programming.

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

Recommended from Medium

Play Google Chrome dinosaur game using OpenCV

7 Signs You’re Outgrowing Your Accounting Software

Deploying your Laravel Application with SQLite to Heroku

Shade Protocol Dev Update #1

How to Import Your Python Scripts with Anaconda on Mac and Windows

iOS Architecture Pattern to boost productivity

How I built a 220k $ app in 4 weeks

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
Rusben Guzman

Rusben Guzman

A Software Engineer passionate about game dev and interactive products with Unity. I consider video games to be the artistic expression of programming.

More from Medium

If…Else Statements | C#

2D Sprite Sword HitBox Setup

Animating Sprites in Unity

Overloading methods in C# & Unity