Skip to content

Commit a3da79d

Browse files
committed
Proofread new article.
1 parent 37c1c12 commit a3da79d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/csharp/programming-guide/classes-and-structs/anonymous-types.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@ ai-usage: ai-assisted
1010
---
1111
# Anonymous types (C# Programming Guide)
1212

13-
Anonymous types provide a convenient way to encapsulate a set of read-only properties into a single object without defining a named type first. The compiler generates a type name at compile time that isn't accessible in your source code. The compiler infers the type of each property.
13+
Anonymous types provide a convenient way to encapsulate a set of read-only properties into a single object without defining a named type first. The compiler generates a type name at compile time that you can't access in your source code. The compiler infers the type of each property.
1414

1515
Create anonymous types by using the [`new`](../../language-reference/operators/new-operator.md) operator together with an object initializer. The following example shows an anonymous type that's initialized with two properties, `Name` and `Age`:
1616

1717
:::code language="csharp" source="./snippets/anonymous-types/csharp/Program.cs" id="BasicAnonymousType":::
1818

1919
## Inferred property names
2020

21-
You can specify property names explicitly with `Name = value` syntax. When you initialize an anonymous type with a variable or member access expression, the compiler infers the property name from that expression:
21+
You can specify property names explicitly by using the `Name = value` syntax. When you initialize an anonymous type with a variable or member access expression, the compiler infers the property name from that expression:
2222

2323
:::code language="csharp" source="./snippets/anonymous-types/csharp/Program.cs" id="InferredNames":::
2424

2525
In the preceding example, the compiler infers `productName` and `price` as the property names from the variable names used in the initializer.
2626

2727
## Declare anonymous types with var
2828

29-
Because the type name is generated by the compiler and isn't available in source code, you must use [`var`](../../language-reference/statements/declarations.md#implicitly-typed-local-variables) to declare the local variable. You can't specify the type name explicitly:
29+
Because the compiler generates the type name and you can't access it in source code, you must use [`var`](../../language-reference/statements/declarations.md#implicitly-typed-local-variables) to declare the local variable. You can't specify the type name explicitly:
3030

3131
```csharp
3232
// You must use var — you can't write a named type here.

0 commit comments

Comments
 (0)