F# – Define empty class, struct or interface types

In C#, you define an emp­ty class, struct, or inter­face like this:

image

So how do you define an emp­ty type in F#?

Well, when­ev­er you define a new class in F#, the com­pil­er infers the class and end tokens at the begin­ning and end of the class’s def­i­n­i­tion, as you can see from below:

image

So the eas­i­est way to define an emp­ty type is to spec­i­fy the class and end tokens explic­it­ly:

image

Run­ning these few lines of code into the F# inter­ac­tive out­puts the fol­low­ing:

image

For class types, you also have oth­er alter­na­tive tech­niques, such as:

image