F# equivalent of C#’s Object Initialization syntax

In C#, you can use the object/collection ini­tial­iza­tion syn­tax like this:

image

The F# equiv­a­lent of object ini­tial­iza­tion is done like this:

image

As for col­lec­tion ini­tial­iza­tion, you have a far more diverse range of tools avail­able to you, for exam­ple:

image

You can also cre­ate slices of an exist­ing array:

image

You can even add your own mul­ti-dimen­sion­al index­ers to sup­port sim­i­lar behav­iours in your type too!

Update 2012/01/11:

As Robert Pick­er­ing men­tioned in the com­ments, slic­ing is not lim­it­ed to arrays, it works with oth­er col­lec­tion types too (as long as a Get­Slice exten­sion method is defined on the type, for more infor­ma­tion, see here). For instance, you can use slic­ing on a string like this:

image

With 2D arrays, you can also use a mul­ti-dimen­sion­al slicer too:

image