softshipper
softshipper

Reputation: 34071

Create collection of type

I created a record type

type IpRanges = {ipStart: IPAddress; ipEnd: IPAddress; subnet: IPAddress; mask: IPAddress}

How can I create a collection type of IpRanges?

type CollRanges = ???

Upvotes: 0

Views: 55

Answers (1)

Gus
Gus

Reputation: 26174

What kind of collection do you want to create?

A list of IPRanges? If so you can do it like this:

type CollRanges = List<IpRanges>

But since list is generic your CollRanges doesn't really need to be a new type, indeed the previous line will create a type alias which is a good thing since you will reuse all the functionality of the List type and your collection will be more cohesive (plugabble) with existing F# code. The same applies to any other generic collection, like Array, Seq, ResizeArray, ...

Upvotes: 2

Related Questions