Write Clean Code (edit)
https://github.com/thangchung/clean-code-dotnet
https://www.codingblocks.net/software-development-tips-and-tricks/
Ternary Operator Example (? :)
return value = 10 ? true : false;
Null Coalescing Operator Example (??)
return artist ?? new Artist() {};
Prefer String interpolation
string temp = $"Name: {name}, Age: {age}";
Use expression bodied Methods
public string GetMessage() => return "Hello World";
public string Name => "Afzaal Ahmad Zeeshan";
A few things you should know prior to reading this guide:
- Improvements to C# that were made in its 6th version
- LINQ in .NET framework
- Asynchronous programming and Task object in C#
- Unsafe programming in C#, which allows you to go into memory management
Curly braces + Check null
public void Draw(Shape shape)
{
if (shape == null)
throw new ArgumentNullException("shape");