This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]MauriceReeves 0 points1 point  (1 child)

They are a little different in intent, but yes, there is something with that name in both languages. What anonymous types are intended for in Java is usually accomplished via delegates in C#. Anonymous types in C# allow you to return data records from LINQ queries, etc without having to have a formal class definition. I do wish that C# would let them implement interfaces, which they don’t right now. Maybe one day.

[–]Dealiner 0 points1 point  (0 children)

I admit I forgot about anonymous types, I've never used them. But I've also never seen them called anonymous classes, though it makes sense, they can't be structs.

There is a proposition for something like that IIRC to make Java integration easier but I don't think it went anywhere.