Chapter 2. Using F# for Object-Oriented Programming

Object-oriented programming (OOP) has been a great success. Many modern business systems are designed and implemented by applying OOP concepts. I will not discuss the benefit of using OOP because, as a C# developer, you probably already have hundreds of such benefits in mind.

F# is a multiparadigm language that supports OOP. Practically everything you can do with C# can be done with F#, and usually with less code. I will follow the approach from the first chapter, converting C# code to F#. Example 2-1 shows a C# Point2D class, which represents a point on a two-dimensional (2D) surface. It shows properties, static and nonstatic fields, an attribute, and member methods. The conversion task will ...

Get F# for C# Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.