O'Reilly logo

F# for C# Developers by Tao Liu

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. Other Unique Features

In previous chapters, I showed you exciting things you can do in F# as well as various F# data structures. This chapter itemizes the F# data structures and describes them in detail. This chapter is crucial to starting your F# development in full swing.

Working with Reference Cells

You already used the reference cell in Example 1-86 from Chapter 1. In that code, a reference cell was used to wrap a ref parameter. According to the MSDN documentation, a reference cell is a storage structure used to create mutable data. The reference cell definition is shown in Example 6-1, which is actually a record type containing a mutable variable.

Example 6-1. Reference cell definition
type Ref<'a> =
    { mutable contents: 'a }

This is ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required