Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
C# 7 and .NET Core 2.0 High Performance

You're reading from  C# 7 and .NET Core 2.0 High Performance

Product type Book
Published in Apr 2018
Publisher
ISBN-13 9781788470049
Pages 300 pages
Edition 1st Edition
Languages
Author (1):
Ovais Mehboob Ahmed Khan Ovais Mehboob Ahmed Khan
Profile icon Ovais Mehboob Ahmed Khan

Table of Contents (11) Chapters

Preface 1. What's New in .NET Core 2 and C# 7? 2. Understanding .NET Core Internals and Measuring Performance 3. Multithreading and Asynchronous Programming in .NET Core 4. Data Structures and Writing Optimized Code in C# 5. Designing Guidelines for .NET Core Application Performance 6. Memory Management Techniques in .NET Core 7. Securing and Implementing Resilience in .NET Core Applications 8. Microservices Architecture 9. Monitoring Application Performance Using Tools 10. Other Books You May Enjoy

Best practices for disposing of objects in .NET Core

We have learned in the previous section that object disposal in .NET Core is automatically done by the GC. Nevertheless, disposing of objects in your code is always a good practice, and is highly recommended when you are working with unmanaged objects. In this section, we will explore some best practices that can be used to dispose of objects while writing code in .NET Core.

Introduction to the IDisposable interface

IDisposable is a simple interface that contains one Dispose method, takes no parameter, and returns void:

public interface IDisposable 
{ 
  void Dispose(); 
} 

It is used to release unmanaged resources. So if any class implements the IDisposable interface, it...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}