Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/csharp/fundamentals/types/anonymous-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ You cannot declare a field, a property, an event, or the return type of a method

Because the <xref:System.Object.Equals%2A> and <xref:System.Object.GetHashCode%2A> methods on anonymous types are defined in terms of the `Equals` and `GetHashCode` methods of the properties, two instances of the same anonymous type are equal only if all their properties are equal.

> [!NOTE]
> The [default accessibility level](../../programming-guide/classes-and-structs/access-modifiers.md#default-access-summary-table) of an anonymous type is `internal`, hence two anonymous types defined in different assemblies are not of the same type.
> Therefore instances of anonymous types can't be equal to each other when defined in different assemblies, even when having all their properties equal.

Anonymous types do override the <xref:System.Object.ToString%2A> method, concatenating the name and `ToString` output of every property surrounded by curly braces.

```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Delegates behave like classes and structs. By default, they have `internal` acce
| `record` | internal |
| `enum` | internal |
| `interface` members | public |
| Anonymous types | internal |
| [class, record, and struct members](./members.md) | private |

For more details see the [Accessibility Levels](../../language-reference/keywords/accessibility-levels.md) page.
Expand All @@ -103,3 +104,4 @@ For more details see the [Accessibility Levels](../../language-reference/keyword
- [class](../../language-reference/keywords/class.md)
- [struct](../../language-reference/builtin-types/struct.md)
- [interface](../../language-reference/keywords/interface.md)
- [Anonymous types](../../fundamentals/types/anonymous-types.md)