Comment on First C# 7 Design Meeting NotesparentComments−riffraff11ydoesn't C# already have structs ? how are records different from that?−sanxiyn11yStructs have names. Records don't.See http://en.wikipedia.org/wiki/Nominal_type_system and http://en.wikipedia.org/wiki/Structural_type_system.−jameshart11yC# has anonymous types, which are closer to records, but there's no way to refer to a particular type structure.So while I can write var x = { FirstName = "Riff", LastName = "Raff" } and then go ahead and access x.FirstName and x.LastName, I can't declare a method signature like this: void Display({ string FirstName, string LastName } nameRecord) { } This is the kind of thing which is being proposed (along with possible pattern matching/decomposition syntax which is new ground for C#)−nikbackm11yhttp://stackoverflow.com/questions/5858550/f-records-vs-net-...
Comments
doesn't C# already have structs ? how are records different from that?
Structs have names. Records don't.
See http://en.wikipedia.org/wiki/Nominal_type_system and http://en.wikipedia.org/wiki/Structural_type_system.
C# has anonymous types, which are closer to records, but there's no way to refer to a particular type structure.
So while I can write
and then go ahead and access x.FirstName and x.LastName, I can't declare a method signature like this: This is the kind of thing which is being proposed (along with possible pattern matching/decomposition syntax which is new ground for C#)http://stackoverflow.com/questions/5858550/f-records-vs-net-...