Basic Math - Add/subtract or increment/decrement assignment
The shortened version also supports other math operations.
String Interpolation
String Interpolation is an easier way to build strings out of multiple pieces.
Expression-bodied members
A C#6 feature that is syntactic sugar (designed to make things easier to read or express).
Lambda expressions
Shorthand syntax for anonymous delegates - C# Programming Guide.
var keyword
The var keyword allows you to create variables without telling the compiler what type it is. The compiler will infer the type.
Inine out parameters
Since C#7, you can inline an out parameter. No need to create a local variable.
Value Tuples
Value Tuples allow you to group values without having to create a Struct/Class.
Example without deconstruction.
Example with deconstruction to reduce repetition
Example using a list.
Multiple return types
You can effectively have multiple return types by using Value Tuples.
Method Chaining
Method chaining can be achieved when a Method returns the instance of the Class it’s inside.
They can be used to create Fluent Interface API’s.
There is an excellent Finite State Machine and Behaviour Tree for Unity that do this. See the associated article.
Cast Interface to MonoBehaviour
When working with Interfaces that are implemented on MonoBehaviours, you will not be able to access the Component or GameObject the Interface is on.
To allow this, you must cast it.
Notes
- https://www.algorithm-archive.org