C# data class to F# record
Converting from C# to F# is not hard, but requires some manual labor. Here you should convert from a C# data class to a F# record.
public enum State { Active, Inactive } public struct Price { public decimal Amount { get; set; } public decimal Vat { get; set; } } public class Ticket { public State State { get; set; } public int Count { get; set; } public Price Price { get; set; } public DateTime DepartureDate { get; set; } public DateTime? ReturnDate { get; set; } }
type State = Active | Inactive type Price = { amount: decimal vat: decimal } type Ticket = { state: State count: int price: Price departureDate: DateTime returnDate: DateTime option }