Give Your .NET Object A Shot Of Lifeline [Tutorial] by@anand-gupta
131 reads

Give Your .NET Object A Shot Of Lifeline [Tutorial]

by Anand Gupta11mAugust 3rd, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

In this post, we will see an example of a scenario where we may want to extend the lifetime of an object. We will look at how we can accomplish this in two ways — one is writing an API ourselves (in the spirit of learning by doing) and other is to use existing API in.NET. The Lifeline.KeepAlive() method has absolutely no code in it. The key feature of this method is the attribute on the method [MethodImpl(MethodImplOptions.NoInlining) This guarantees the JIT will never try to inline this method.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Give Your .NET Object A Shot Of Lifeline [Tutorial]
Anand Gupta HackerNoon profile picture
Anand Gupta

Anand Gupta

@anand-gupta

Passionate Techie, Binge Watcher, Globe trotter

Learn More
LEARN MORE ABOUT @ANAND-GUPTA'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

Anand Gupta HackerNoon profile picture
Anand Gupta@anand-gupta
Passionate Techie, Binge Watcher, Globe trotter

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite