Tuesday, September 25, 2018

Deciding When to Use Weak References in .NET

The .NET WeakReference Class represents a weak reference, which references an object while still allowing that object to be reclaimed by garbage collection. Now, let's see an example. Create a console application from Visual Studio and name it MyWeakReference.
Create a WeakReference object and pass an object reference to the constructor call. In the following example, I have used the StringBuilder object.

No comments:

Post a Comment

Mocking API Responses in Azure API Management Portal

A mock API imitates a real API call by providing a realistic JSON or XML response to the requester. Mock APIs can be designed on a developer...