Skip to content

Tim’s Blog

Software developer

Monthly Archives: July 2024

Do not returns null

If you create a method that return a list and you don’t have data, always return empty list instead of null. This would allow the caller to iterate the list without checking. As an example, consider the 2 blocks of code below, which is better? Having said that, if you write caller side code and …

Continue reading “Do not returns null”

Posted bytimdinh06/07/202406/07/2024Posted inC#Tags: best practices, c#, csharp, programming

Recent Posts

  • Secure Your Local Development: Generate HTTPS Certificates for .test or .internal Domains
  • Embracing Clean Code: Why Quick Hacks Are OK—But Only Temporarily
  • Do not returns null
  • C# Exception Handler
  • Startup configure method

Archives

  • February 2025
  • December 2024
  • July 2024
  • June 2024
  • June 2021

Categories

  • ASPNET Core
  • C#
  • coding
  • dotnet core
  • Uncategorized
Tim’s Blog, Proudly powered by WordPress.