Javatpoint Logo
Javatpoint Logo

F# Resource Management

F# manages resources with the help of use and using keywords. Resources may be data, a file or network etc. It acquires resource from operating system or other service provider so that it can be provided to other application.

It releases resources promptly and in a predictable manner. The dispose method of System.IDisposal interface implicitly releases the resources which are free.

F# uses two dispose patterns: the use binding and using function.

F# use binding

It provides same functionality as let bindings. It calls disposal method to release resources which are not in use from long time.

Let's see an example.

In the above example, after executing writeline() method. The use keyword call dispose() method implicitly and release the file resource.

F# using Function

The using function creates an object that must be disposed. It can be used in either lambda function or in function code.

Next TopicF# Attribute




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA