This article will show by example how to dispose of disposable objects when using the async/ await pattern.
Tag: Tip of the Week
Coding Faster with the dotNetTips Utility: StringBuilder Extensions
Recently, I was looking at the source code for Entity Framework Core and found a few interesting extension methods for the StringBuilder class. So I moved the ones I liked to my open-source project called dotNetTips.Utility.Standard.Extensions and is part of the NuGet package too. Appending Bytes If you want to combine an array of byte … Continue reading Coding Faster with the dotNetTips Utility: StringBuilder Extensions
Setting Up ASP.NET Core: Response Compression
In one of my conference talks, I ask the attendees this question: What is the #1 performance killer for modern day apps? I get lots of answers, but the actual answer is the internet! I'm not just saying this, I know this to be true. Over 10 years ago, I wrote the first public API … Continue reading Setting Up ASP.NET Core: Response Compression
Properly Comparing Strings with Globalization and Performance in .NET
In Microsoft .NET there are many ways to compare strings. I would say that most of the code I analyze, I see it done one of these two ways: bool result = email1 == email2; bool result = email1.Equals(email2); Is this the best way to compare strings? The quick answer is no. While this works, … Continue reading Properly Comparing Strings with Globalization and Performance in .NET
Performance: Exception Trapping
Last year while presenting my Rock Your Code: Code and App Performance in Microsoft .NET session at a conference, one of the attendees asked me if using the When() clause is faster or not when trapping Exceptions. I found the question intriguing, so I set out to do performance testing for his question. Two Ways … Continue reading Performance: Exception Trapping
Proper Type Encapsulation – Part 2
In part 1 of this article, I explained how to implement proper data encapsulation. In part 2 I want to talk about encapsulating business logic. I see this missing in a lot of type design, especially when using an ORM like Entity Framework. It’s the job of the architect and coder of that type to … Continue reading Proper Type Encapsulation – Part 2
Performance Tip: Checking For Empty String
In all my books and conference sessions I talk about the proper way to test if a string is valid. Microsoft .NET has been around almost two decades and I still see code like this: if (testValue.Trim() == "") This code is even wrong since it's not checking for null. A better way would be like this: … Continue reading Performance Tip: Checking For Empty String
Processing AWS SQS Messages via a LAMBDA
With the short time I have been programming using Amazon Web Services (AWS) I have learned three things... AWS is NOT .NET Framework friendly! They are more .NET Core friendly but don't keep up with the latest version. The AWS .NET SDK needs a lot of work. I've previously wrote about this in my "Is … Continue reading Processing AWS SQS Messages via a LAMBDA
Proper Type Encapsulation – Part 1
Encapsulation is the first pillar of Object-Oriented Programming and maybe the most important. This is how wikipedia.org defines encapsulation: Encapsulation is one of the fundamentals of OOP (object-oriented programming). It refers to the bundling of data with the methods that operate on that data. Encapsulation is used to hide the values or state of a … Continue reading Proper Type Encapsulation – Part 1
Is Quality Part of Open-Source Projects Your App Is Using?
Is code quality important to your team? It should be at the top of the list, not only to make your customers happy, but make your team happier when bugs arise and when features need to be added. Putting quality in your code in the future is a lot more expensive than doing it when … Continue reading Is Quality Part of Open-Source Projects Your App Is Using?
You must be logged in to post a comment.