From ed97bb11dca044606e4a8d56dbf22bbe46a8d316 Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Fri, 25 Oct 2024 17:50:02 -0400 Subject: [PATCH] Replace "auto implemented" with "automatically" (#43211) * Replace "auto implemented" with "automatically" Fixes #42252 In preparation for "field backed properties", make sure all our docs use the correct "automatically implemented" terminology. Because, field backed properties are kind of auto-implemented as well. I did update the VB docs as well, to keep them consistent. * fix the warnings * Apply suggestions from code review Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --------- Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --- .../interop/walkthrough-office-programming.md | 18 +++++------ .../reflection-and-attributes/index.md | 2 +- docs/csharp/fundamentals/types/interfaces.md | 2 +- docs/csharp/how-to/index.md | 2 +- .../language-reference/attributes/general.md | 2 +- .../builtin-types/struct.md | 4 +-- .../compiler-messages/cs0840.md | 4 +-- .../compiler-messages/cs8145.md | 2 +- .../compiler-messages/partial-declarations.md | 2 +- .../compiler-messages/ref-struct-errors.md | 2 +- .../csharp/language-reference/keywords/get.md | 6 ++-- .../keywords/group-clause.md | 2 +- .../language-reference/keywords/init.md | 2 +- .../language-reference/keywords/interface.md | 2 +- .../csharp/language-reference/keywords/set.md | 6 ++-- .../operators/equality-operators.md | 2 +- docs/csharp/misc/cs0200.md | 2 +- docs/csharp/misc/cs0842.md | 2 +- .../auto-implemented-properties.md | 16 +++++----- ...-class-with-auto-implemented-properties.md | 12 +++---- .../interface-properties.md | 2 +- .../object-and-collection-initializers.md | 2 +- .../partial-classes-and-methods.md | 2 +- .../classes-and-structs/properties.md | 10 +++--- .../restricting-accessor-accessibility.md | 2 +- .../BasicObjectInitializers.cs | 4 +-- .../classes-and-structs/using-properties.md | 6 ++-- ...parison-between-properties-and-indexers.md | 2 +- .../programming-guide/indexers/index.md | 2 +- docs/csharp/toc.yml | 4 +-- .../whats-new/csharp-version-history.md | 2 +- .../explicit-fields-the-val-keyword.md | 2 +- .../code-analysis/style-rules/ide0032.md | 4 +-- .../functionality-reference.md | 2 +- .../statements/property-statement.md | 8 ++--- docs/visual-basic/misc/bc36714.md | 12 +++---- .../walkthrough-office-programming.md | 6 ++-- .../concepts/object-oriented-programming.md | 6 ++-- .../collection-initializers/index.md | 2 +- .../procedures/auto-implemented-properties.md | 32 +++++++++---------- .../procedures/property-procedures.md | 2 +- .../language-features/procedures/toc.yml | 2 +- docs/visual-basic/whats-new/index.md | 2 +- .../CS/csRef30LangFeatures_2.cs | 2 +- .../csProgGuideStatements/CS/Statements.cs | 4 +-- .../CS/csrefKeywordsModifiers.cs | 4 +-- 46 files changed, 110 insertions(+), 110 deletions(-) diff --git a/docs/csharp/advanced-topics/interop/walkthrough-office-programming.md b/docs/csharp/advanced-topics/interop/walkthrough-office-programming.md index 218348b68060a..f24beeb243e6d 100644 --- a/docs/csharp/advanced-topics/interop/walkthrough-office-programming.md +++ b/docs/csharp/advanced-topics/interop/walkthrough-office-programming.md @@ -49,7 +49,7 @@ In **Solution Explorer**, right-click the **ThisAddIn.cs** file and then select ## Create a list of bank accounts -In **Solution Explorer**, right-click your project's name, select **Add**, and then select **Class**. Name the class Account.cs. Select **Add**. Replace the definition of the `Account` class with the following code. The class definitions use *auto-implemented properties*. +In **Solution Explorer**, right-click your project's name, select **Add**, and then select **Class**. Name the class Account.cs. Select **Add**. Replace the definition of the `Account` class with the following code. The class definitions use *automatically implemented properties*. :::code language="csharp" source="./snippets/OfficeWalkthrough/account.cs" id="AccountClass"::: @@ -122,13 +122,13 @@ In Visual Studio, select **Clean Solution** on the **Build** menu. Otherwise, th ## See also -- [Auto-Implemented Properties (C#)](../../programming-guide/classes-and-structs/auto-implemented-properties.md) -- [Object and Collection Initializers](../../programming-guide/classes-and-structs/object-and-collection-initializers.md) +- [Automatically implemented properties (C#)](../../programming-guide/classes-and-structs/auto-implemented-properties.md) +- [Object and collection initializers](../../programming-guide/classes-and-structs/object-and-collection-initializers.md) - [Visual Studio Tools for Office (VSTO)](/visualstudio/vsto/visual-studio-tools-for-office-runtime-overview) -- [Named and Optional Arguments](../../programming-guide/classes-and-structs/named-and-optional-arguments.md) +- [Named and optional arguments](../../programming-guide/classes-and-structs/named-and-optional-arguments.md) - [dynamic](../../language-reference/builtin-types/reference-types.md) -- [Using Type dynamic](using-type-dynamic.md) -- [Lambda Expressions (C#)](../../language-reference/operators/lambda-expressions.md) -- [Walkthrough: Embedding Type Information from Microsoft Office Assemblies in Visual Studio](/previous-versions/visualstudio/visual-studio-2013/ee317478(v=vs.120)) -- [Walkthrough: Embedding Types from Managed Assemblies](../../../standard/assembly/embed-types-visual-studio.md) -- [Walkthrough: Creating Your First VSTO Add-in for Excel](/visualstudio/vsto/walkthrough-creating-your-first-vsto-add-in-for-excel) +- [Using type dynamic](using-type-dynamic.md) +- [Lambda expressions (C#)](../../language-reference/operators/lambda-expressions.md) +- [Walkthrough: Embedding type information from Microsoft Office assemblies in Visual Studio](/previous-versions/visualstudio/visual-studio-2013/ee317478(v=vs.120)) +- [Walkthrough: Embedding types from managed assemblies](../../../standard/assembly/embed-types-visual-studio.md) +- [Walkthrough: Creating your first VSTO add-in for Excel](/visualstudio/vsto/walkthrough-creating-your-first-vsto-add-in-for-excel) diff --git a/docs/csharp/advanced-topics/reflection-and-attributes/index.md b/docs/csharp/advanced-topics/reflection-and-attributes/index.md index 3a4a137ca125e..f022192286501 100644 --- a/docs/csharp/advanced-topics/reflection-and-attributes/index.md +++ b/docs/csharp/advanced-topics/reflection-and-attributes/index.md @@ -95,7 +95,7 @@ The list of possible `target` values is shown in the following table. | `return` | Return value of a method, property indexer, or `get` property accessor | | `type` | Struct, class, interface, enum, or delegate | -You would specify the `field` target value to apply an attribute to the backing field created for an [auto-implemented property](../../programming-guide/classes-and-structs/properties.md). +You would specify the `field` target value to apply an attribute to the backing field created for an [automatically implemented property](../../programming-guide/classes-and-structs/properties.md). The following example shows how to apply attributes to assemblies and modules. For more information, see [Common Attributes (C#)](../../language-reference/attributes/global.md). diff --git a/docs/csharp/fundamentals/types/interfaces.md b/docs/csharp/fundamentals/types/interfaces.md index 64a6d423717f3..9d8984031bd81 100644 --- a/docs/csharp/fundamentals/types/interfaces.md +++ b/docs/csharp/fundamentals/types/interfaces.md @@ -8,7 +8,7 @@ helpviewer_keywords: --- # Interfaces - define behavior for multiple types -An interface contains definitions for a group of related functionalities that a non-abstract [`class`](../../language-reference/keywords/class.md) or a [`struct`](../../language-reference/builtin-types/struct.md) must implement. An interface may define `static` methods, which must have an implementation. An interface may define a default implementation for members. An interface may not declare instance data such as fields, auto-implemented properties, or property-like events. +An interface contains definitions for a group of related functionalities that a non-abstract [`class`](../../language-reference/keywords/class.md) or a [`struct`](../../language-reference/builtin-types/struct.md) must implement. An interface may define `static` methods, which must have an implementation. An interface may define a default implementation for members. An interface may not declare instance data such as fields, automatically implemented properties, or property-like events. By using interfaces, you can, for example, include behavior from multiple sources in a class. That capability is important in C# because the language doesn't support multiple inheritance of classes. In addition, you must use an interface if you want to simulate inheritance for structs, because they can't actually inherit from another struct or class. diff --git a/docs/csharp/how-to/index.md b/docs/csharp/how-to/index.md index 702042420c230..6149fe9c82588 100644 --- a/docs/csharp/how-to/index.md +++ b/docs/csharp/how-to/index.md @@ -22,7 +22,7 @@ There are several tips and tricks that are common C# developer practices: You create classes, records, and structs to implement your program. These techniques are commonly used when writing classes, records, or structs. -- [Declare auto implemented properties](../programming-guide/classes-and-structs/how-to-implement-a-lightweight-class-with-auto-implemented-properties.md). +- [Declare automatically implemented properties](../programming-guide/classes-and-structs/how-to-implement-a-lightweight-class-with-auto-implemented-properties.md). - [Declare and use read/write properties](../programming-guide/classes-and-structs/how-to-declare-and-use-read-write-properties.md). - [Define constants](../programming-guide/classes-and-structs/how-to-define-constants.md). - [Override the `ToString` method to provide string output](../programming-guide/classes-and-structs/how-to-override-the-tostring-method.md). diff --git a/docs/csharp/language-reference/attributes/general.md b/docs/csharp/language-reference/attributes/general.md index 1f5e9902e8819..00855cba57adb 100644 --- a/docs/csharp/language-reference/attributes/general.md +++ b/docs/csharp/language-reference/attributes/general.md @@ -120,7 +120,7 @@ If is `false`, then derived clas In this case, `NonInheritedAttribute` isn't applied to `DClass` via inheritance. -You can also use these keywords to specify where an attribute should be applied. For example, you can use the `field:` specifier to add an attribute to the backing field of an [autoimplemented property](../../programming-guide/classes-and-structs/properties.md#auto-implemented-properties). Or you can use the `field:`, `property:` or `param:` specifier to apply an attribute to any of the elements generated from a positional record. For an example, see [Positional syntax for property definition](../builtin-types/record.md#positional-syntax-for-property-definition). +You can also use these keywords to specify where an attribute should be applied. For example, you can use the `field:` specifier to add an attribute to the backing field of an [automatically implemented property](../../programming-guide/classes-and-structs/properties.md#automatically-implemented-properties). Or you can use the `field:`, `property:` or `param:` specifier to apply an attribute to any of the elements generated from a positional record. For an example, see [Positional syntax for property definition](../builtin-types/record.md#positional-syntax-for-property-definition). ## `AsyncMethodBuilder` attribute diff --git a/docs/csharp/language-reference/builtin-types/struct.md b/docs/csharp/language-reference/builtin-types/struct.md index 97183470d1457..5fecf3081b714 100644 --- a/docs/csharp/language-reference/builtin-types/struct.md +++ b/docs/csharp/language-reference/builtin-types/struct.md @@ -28,7 +28,7 @@ Because structure types have value semantics, we recommend you define *immutable You use the `readonly` modifier to declare that a structure type is immutable. All data members of a `readonly` struct must be read-only as follows: - Any field declaration must have the [`readonly` modifier](../keywords/readonly.md) -- Any property, including auto-implemented ones, must be read-only or [`init` only](../keywords/init.md). Note that init-only setters are only available from [C# version 9 onwards](../../whats-new/csharp-version-history.md). +- Any property, including automatically implemented ones, must be read-only or [`init` only](../keywords/init.md). Note that init-only setters are only available from [C# version 9 onwards](../../whats-new/csharp-version-history.md). That guarantees that no member of a `readonly` struct modifies the state of the struct. That means that other instance members except constructors are implicitly [`readonly`](#readonly-instance-members). @@ -62,7 +62,7 @@ Typically, you apply the `readonly` modifier to the following kinds of instance If you need to apply the `readonly` modifier to both accessors of a property or indexer, apply it in the declaration of the property or indexer. > [!NOTE] - > The compiler declares a `get` accessor of an [auto-implemented property](../../programming-guide/classes-and-structs/auto-implemented-properties.md) as `readonly`, regardless of presence of the `readonly` modifier in a property declaration. + > The compiler declares a `get` accessor of an [automatically implemented property](../../programming-guide/classes-and-structs/auto-implemented-properties.md) as `readonly`, regardless of presence of the `readonly` modifier in a property declaration. You may apply the `readonly` modifier to a property or indexer with an `init` accessor: diff --git a/docs/csharp/language-reference/compiler-messages/cs0840.md b/docs/csharp/language-reference/compiler-messages/cs0840.md index cf364a1742a9c..f8bbbacbc3e79 100644 --- a/docs/csharp/language-reference/compiler-messages/cs0840.md +++ b/docs/csharp/language-reference/compiler-messages/cs0840.md @@ -12,7 +12,7 @@ ms.assetid: f307083f-8d86-4142-a9fd-b735910687b2 'Property name' must declare a body because it is not marked abstract or extern. Automatically implemented properties must define both get and set accessors. - Unless a regular property is marked as `abstract` or `extern`, or is a member of a `partial` type, it must supply a body. Auto-implemented properties do not provide accessor bodies, but they must specify both accessors. To create a read-only auto-implemented property, make the set accessor `private`. + Unless a regular property is marked as `abstract` or `extern`, or is a member of a `partial` type, it must supply a body. Automatically implemented properties do not provide accessor bodies, but they must specify both accessors. To create a read-only automatically implemented property, make the set accessor `private`. ## To correct this error @@ -39,4 +39,4 @@ class Test ## See also -- [Auto-Implemented Properties](../../programming-guide/classes-and-structs/auto-implemented-properties.md) +- [Automatically implemented properties](../../programming-guide/classes-and-structs/auto-implemented-properties.md) diff --git a/docs/csharp/language-reference/compiler-messages/cs8145.md b/docs/csharp/language-reference/compiler-messages/cs8145.md index ae5929599d91e..bb66a26c75b32 100644 --- a/docs/csharp/language-reference/compiler-messages/cs8145.md +++ b/docs/csharp/language-reference/compiler-messages/cs8145.md @@ -11,7 +11,7 @@ helpviewer_keywords: Auto-implemented properties cannot return by reference -Auto-implemented properties are not guaranteed to have a member or variable that can be referenced and thus do not support return by reference. +Automatically implemented properties are not guaranteed to have a member or variable that can be referenced and thus do not support return by reference. ## Example diff --git a/docs/csharp/language-reference/compiler-messages/partial-declarations.md b/docs/csharp/language-reference/compiler-messages/partial-declarations.md index fcdd1d52f6bed..2677cf331725a 100644 --- a/docs/csharp/language-reference/compiler-messages/partial-declarations.md +++ b/docs/csharp/language-reference/compiler-messages/partial-declarations.md @@ -229,4 +229,4 @@ The following warning indicates a signature difference in the declaring and impl - **CS9256**: *Partial property declarations have signature differences.* -A partial property or indexer must have both a *declaring declaration* and an *implementing declaration*. The signatures for both declarations must match. Because the *declaring declaration* uses the same syntax as an auto-implemented property, the *implementing declaration* can't be an auto-implemented property. The accessors must have bodies. +A partial property or indexer must have both a *declaring declaration* and an *implementing declaration*. The signatures for both declarations must match. Because the *declaring declaration* uses the same syntax as an automatically implemented property, the *implementing declaration* can't be an automatically implemented property. The accessors must have bodies. diff --git a/docs/csharp/language-reference/compiler-messages/ref-struct-errors.md b/docs/csharp/language-reference/compiler-messages/ref-struct-errors.md index 9df47c00225eb..991b4777132e4 100644 --- a/docs/csharp/language-reference/compiler-messages/ref-struct-errors.md +++ b/docs/csharp/language-reference/compiler-messages/ref-struct-errors.md @@ -56,7 +56,7 @@ ms.date: 07/30/2024 A [`ref struct`](../builtin-types/ref-struct.md) type can include `ref` fields. Other types aren't allowed `ref` fields. The compiler enforces restrictions on the declarations and use of `ref struct` types to enforce ref safety rules on instances of any `ref struct` type: -- Only `ref struct` types can contain auto-implemented `ref` properties. +- Only `ref struct` types can contain automatically implemented `ref` properties. - Only `ref struct` types or `ref` variables can have the `scoped` modifier. - A `ref` field can be declared only in a `ref struct` type. - A `ref` field can't refer to a `ref struct` type/ diff --git a/docs/csharp/language-reference/keywords/get.md b/docs/csharp/language-reference/keywords/get.md index 90303ee39d64e..ef716ca5df4ab 100644 --- a/docs/csharp/language-reference/keywords/get.md +++ b/docs/csharp/language-reference/keywords/get.md @@ -10,7 +10,7 @@ helpviewer_keywords: --- # get (C# Reference) -The `get` keyword defines an *accessor* method in a property or indexer that returns the property value or the indexer element. For more information, see [Properties](../../programming-guide/classes-and-structs/properties.md), [Auto-Implemented Properties](../../programming-guide/classes-and-structs/auto-implemented-properties.md), and [Indexers](../../programming-guide/indexers/index.md). +The `get` keyword defines an *accessor* method in a property or indexer that returns the property value or the indexer element. For more information, see [Properties](../../programming-guide/classes-and-structs/properties.md), [Automatically implemented Properties](../../programming-guide/classes-and-structs/automatically implemented-properties.md), and [Indexers](../../programming-guide/indexers/index.md). The following example defines both a `get` and a `set` accessor for a property named `Seconds`. It uses a private field named `_seconds` to back the property value. @@ -20,12 +20,12 @@ Often, the `get` accessor consists of a single statement that returns a value, a :::code language="csharp" source="./snippets/PropertyAccessors.cs" id="GetSetExpressions"::: -For simple cases in which a property's `get` and `set` accessors perform no other operation than setting or retrieving a value in a private backing field, you can take advantage of the C# compiler's support for auto-implemented properties. The following example implements `Hours` as an auto-implemented property. +For simple cases in which a property's `get` and `set` accessors perform no other operation than setting or retrieving a value in a private backing field, you can take advantage of the C# compiler's support for automatically implemented properties. The following example implements `Hours` as an automatically implemented property. :::code language="csharp" source="./snippets/PropertyAccessors.cs" id="AutoImplementedProperties"::: > [!IMPORTANT] -> Auto-implemented properties aren't allowed for [interface property declarations](../../programming-guide/classes-and-structs/interface-properties.md) or [partial property declarations](./partial-member.md). In both cases, the compiler interprets syntax matching an auto-implemented property as the declaring declaration, not an implementing declaration. +> Automatically implemented properties aren't allowed for [interface property declarations](../../programming-guide/classes-and-structs/interface-properties.md) or the implementing declaration for a [partial property](./partial-member.md). The compiler interprets syntax matching an automatically implemented property as the declaring declaration, not an implementing declaration. ## C# Language Specification diff --git a/docs/csharp/language-reference/keywords/group-clause.md b/docs/csharp/language-reference/keywords/group-clause.md index fb543a472a8a6..7bdaee3f3d25c 100644 --- a/docs/csharp/language-reference/keywords/group-clause.md +++ b/docs/csharp/language-reference/keywords/group-clause.md @@ -60,7 +60,7 @@ Use a composite key when you want to group elements according to more than one k group person by new {name = person.surname, city = person.city}; ``` -Use a named type if you must pass the query variable to another method. Create a special class using auto-implemented properties for the keys, and then override the and methods. You can also use a struct, in which case you do not strictly have to override those methods. For more information see [How to implement a lightweight class with auto-implemented properties](../../programming-guide/classes-and-structs/how-to-implement-a-lightweight-class-with-auto-implemented-properties.md) and [How to query for duplicate files in a directory tree](../../linq/how-to-query-files-and-directories.md). The latter article has a code example that demonstrates how to use a composite key with a named type. +Use a named type if you must pass the query variable to another method. Create a special class using automatically implemented properties for the keys, and then override the and methods. You can also use a struct, in which case you do not strictly have to override those methods. For more information see [How to implement a lightweight class with automatically implemented properties](../../programming-guide/classes-and-structs/how-to-implement-a-lightweight-class-with-auto-implemented-properties.md) and [How to query for duplicate files in a directory tree](../../linq/how-to-query-files-and-directories.md). The latter article has a code example that demonstrates how to use a composite key with a named type. ## Example 1 diff --git a/docs/csharp/language-reference/keywords/init.md b/docs/csharp/language-reference/keywords/init.md index bffbc345e2b45..d77303ed2f801 100644 --- a/docs/csharp/language-reference/keywords/init.md +++ b/docs/csharp/language-reference/keywords/init.md @@ -11,7 +11,7 @@ helpviewer_keywords: # init (C# Reference) The `init` keyword defines an *accessor* method in a property or indexer. An init-only setter assigns a value to the property or the indexer element **only** during object construction. An `init` enforces immutability, so that once the object is initialized, it can't be changed. An `init` accessor enables calling code to use an [object initializer](../../programming-guide/classes-and-structs/how-to-initialize-objects-by-using-an-object-initializer.md) to set the initial value. As a contrast, an - [auto-implemented property](../../programming-guide/classes-and-structs/auto-implemented-properties.md) with only a `get` setter must be initialized by calling a constructor. A property with a `private set` accessor can be modified after construction, but only in the class. + [automatically implemented property](../../programming-guide/classes-and-structs/auto-implemented-properties.md) with only a `get` setter must be initialized by calling a constructor. A property with a `private set` accessor can be modified after construction, but only in the class. The following example defines both a `get` and an `init` accessor for a property named `YearOfBirth`. It uses a private field named `_yearOfBirth` to back the property value. diff --git a/docs/csharp/language-reference/keywords/interface.md b/docs/csharp/language-reference/keywords/interface.md index 0bc2811b0dcd7..14a33f2e925d7 100644 --- a/docs/csharp/language-reference/keywords/interface.md +++ b/docs/csharp/language-reference/keywords/interface.md @@ -58,7 +58,7 @@ You can try this feature by working with the tutorial on [static abstract member ## Interface inheritance -Interfaces may not contain instance state. While static fields are now permitted, instance fields aren't permitted in interfaces. [Instance auto-properties](../../programming-guide/classes-and-structs/auto-implemented-properties.md) aren't supported in interfaces, as they would implicitly declare a hidden field. This rule has a subtle effect on property declarations. In an interface declaration, the following code doesn't declare an auto-implemented property as it does in a `class` or `struct`. Instead, it declares a property that doesn't have a default implementation but must be implemented in any type that implements the interface: +Interfaces may not contain instance state. While static fields are now permitted, instance fields aren't permitted in interfaces. [Instance auto-properties](../../programming-guide/classes-and-structs/auto-implemented-properties.md) aren't supported in interfaces, as they would implicitly declare a hidden field. This rule has a subtle effect on property declarations. In an interface declaration, the following code doesn't declare an automatically implemented property as it does in a `class` or `struct`. Instead, it declares a property that doesn't have a default implementation but must be implemented in any type that implements the interface: ```csharp public interface INamed diff --git a/docs/csharp/language-reference/keywords/set.md b/docs/csharp/language-reference/keywords/set.md index 0a9a43d1d6a78..ff8b641d1c666 100644 --- a/docs/csharp/language-reference/keywords/set.md +++ b/docs/csharp/language-reference/keywords/set.md @@ -10,7 +10,7 @@ helpviewer_keywords: --- # set (C# Reference) -The `set` keyword defines an *accessor* method in a property or indexer that assigns a value to the property or the indexer element. For more information and examples, see [Properties](../../programming-guide/classes-and-structs/properties.md), [Auto-Implemented Properties](../../programming-guide/classes-and-structs/auto-implemented-properties.md), and [Indexers](../../programming-guide/indexers/index.md). +The `set` keyword defines an *accessor* method in a property or indexer that assigns a value to the property or the indexer element. For more information and examples, see [Properties](../../programming-guide/classes-and-structs/properties.md), [Automatically implemented properties](../../programming-guide/classes-and-structs/auto-implemented-properties.md), and [Indexers](../../programming-guide/indexers/index.md). The following example defines both a `get` and a `set` accessor for a property named `Seconds`. It uses a private field named `_seconds` to back the property value. @@ -20,12 +20,12 @@ Often, the `set` accessor consists of a single statement that assigns a value, a :::code language="csharp" source="./snippets/PropertyAccessors.cs" id="GetSetExpressions"::: -For simple cases in which a property's `get` and `set` accessors perform no other operation than setting or retrieving a value in a private backing field, you can take advantage of the C# compiler's support for auto-implemented properties. The following example implements `Hours` as an auto-implemented property. +For simple cases in which a property's `get` and `set` accessors perform no other operation than setting or retrieving a value in a private backing field, you can take advantage of the C# compiler's support for automatically implemented properties. The following example implements `Hours` as an automatically implemented property. :::code language="csharp" source="./snippets/PropertyAccessors.cs" id="AutoImplementedProperties"::: > [!IMPORTANT] -> Auto-implemented properties aren't allowed for [interface property declarations](../../programming-guide/classes-and-structs/interface-properties.md) or [partial property declarations](./partial-member.md). In both cases, the compiler interprets syntax matching an auto-implemented property as the declaring declaration, not an implementing declaration. +> Automatically implemented properties aren't allowed for [interface property declarations](../../programming-guide/classes-and-structs/interface-properties.md) or the implementing declaration for a [partial property](./partial-member.md). The compiler interprets syntax matching an automatically implemented property as the declaring declaration, not an implementing declaration. ## C# language specification diff --git a/docs/csharp/language-reference/operators/equality-operators.md b/docs/csharp/language-reference/operators/equality-operators.md index c9e00b64c6d3b..c31e9ee511353 100644 --- a/docs/csharp/language-reference/operators/equality-operators.md +++ b/docs/csharp/language-reference/operators/equality-operators.md @@ -49,7 +49,7 @@ As the example shows, user-defined reference types support the `==` operator by ### Record types equality -[Record types](../builtin-types/record.md) support the `==` and `!=` operators that by default provide value equality semantics. That is, two record operands are equal when both of them are `null` or corresponding values of all fields and auto-implemented properties are equal. +[Record types](../builtin-types/record.md) support the `==` and `!=` operators that by default provide value equality semantics. That is, two record operands are equal when both of them are `null` or corresponding values of all fields and automatically implemented properties are equal. :::code language="csharp" source="snippets/shared/EqualityOperators.cs" id="RecordTypesEquality"::: diff --git a/docs/csharp/misc/cs0200.md b/docs/csharp/misc/cs0200.md index c0ad9a85d3ae2..0ee9bbe3db2c8 100644 --- a/docs/csharp/misc/cs0200.md +++ b/docs/csharp/misc/cs0200.md @@ -46,7 +46,7 @@ public class Example } ``` -The following sample uses [auto-implemented properties](../programming-guide/classes-and-structs/auto-implemented-properties.md) and [object initializers](../programming-guide/classes-and-structs/object-and-collection-initializers.md) and still generates CS0200: +The following sample uses [automatically implemented properties](../programming-guide/classes-and-structs/auto-implemented-properties.md) and [object initializers](../programming-guide/classes-and-structs/object-and-collection-initializers.md) and still generates CS0200: ```csharp // CS0200.cs diff --git a/docs/csharp/misc/cs0842.md b/docs/csharp/misc/cs0842.md index 124ff0213dccc..2f1d36dcefcbb 100644 --- a/docs/csharp/misc/cs0842.md +++ b/docs/csharp/misc/cs0842.md @@ -12,7 +12,7 @@ ms.assetid: 93a8b333-efc4-40c7-ae53-5264f721a74f Automatically implemented properties cannot be used inside a type marked with StructLayout(LayoutKind.Explicit). - Auto-implemented properties have their backing fields provided by the compiler and the field is not accessible to source code. Therefore, they are not compatible with . + Automatically implemented properties have their backing fields provided by the compiler and the field is not accessible to source code. Therefore, they are not compatible with . ## To correct this error diff --git a/docs/csharp/programming-guide/classes-and-structs/auto-implemented-properties.md b/docs/csharp/programming-guide/classes-and-structs/auto-implemented-properties.md index 7ab9bd56ba7be..9ce8885985c27 100644 --- a/docs/csharp/programming-guide/classes-and-structs/auto-implemented-properties.md +++ b/docs/csharp/programming-guide/classes-and-structs/auto-implemented-properties.md @@ -1,6 +1,6 @@ --- -title: "Auto-Implemented Properties" -description: For an auto-implemented property in C#, the compiler creates a private, anonymous backing field accessed only through get and set accessors of the property. +title: "Automatically Implemented Properties" +description: For an automatically implemented property in C#, the compiler creates a private, anonymous backing field accessed only through get and set accessors of the property. ms.date: 08/20/2024 f1_keywords: - "propertyInitializer_CSharpKeyword" @@ -8,19 +8,19 @@ helpviewer_keywords: - "auto-implemented properties [C#]" - "properties [C#], auto-implemented" --- -# Auto-Implemented Properties (C# Programming Guide) +# Automatically implemented properties -Auto-implemented properties make property-declaration more concise when no other logic is required in the property accessors. They also enable client code to create objects. When you declare a property as shown in the following example, the compiler creates a private, anonymous backing field that can only be accessed through the property's `get` and `set` accessors. `init` accessors can also be declared as auto-implemented properties. +Automatically implemented properties make property-declaration more concise when no other logic is required in the property accessors. They also enable client code to create objects. When you declare a property as shown in the following example, the compiler creates a private, anonymous backing field that can only be accessed through the property's `get` and `set` accessors. `init` accessors can also be declared as automatically implemented properties. ## Example -The following example shows a simple class that has some auto-implemented properties: +The following example shows a simple class that has some automatically implemented properties: :::code language="csharp" source="./snippets/properties/AutoImplemented.cs" id="Snippet28"::: -You can't declare auto-implemented properties in interfaces. Auto-implemented properties declare a private instance backing field, and interfaces can't declare instance fields. Declaring a property in an interface without defining a body declares a property with accessors that must be implemented by each type that implements that interface. +You can't declare automatically implemented properties in interfaces. Automatically implemented properties declare a private instance backing field, and interfaces can't declare instance fields. Declaring a property in an interface without defining a body declares a property with accessors that must be implemented by each type that implements that interface. -You can initialize auto-implemented properties similarly to fields: +You can initialize automatically implemented properties similarly to fields: ```csharp public string FirstName { get; set; } = "Jane"; @@ -32,7 +32,7 @@ The class that is shown in the previous example is mutable. Client code can chan * Declare a `get` accessor and an `init` accessor (immutable everywhere except during object construction). * Declare the `set` accessor as [private](../../language-reference/keywords/private.md) (immutable to consumers). -For more information, see [How to implement a lightweight class with auto-implemented properties](./how-to-implement-a-lightweight-class-with-auto-implemented-properties.md). +For more information, see [How to implement a lightweight class with automatically implemented properties](./how-to-implement-a-lightweight-class-with-auto-implemented-properties.md). ## See also diff --git a/docs/csharp/programming-guide/classes-and-structs/how-to-implement-a-lightweight-class-with-auto-implemented-properties.md b/docs/csharp/programming-guide/classes-and-structs/how-to-implement-a-lightweight-class-with-auto-implemented-properties.md index 5d6a6d2de46fd..86e8af07f053c 100644 --- a/docs/csharp/programming-guide/classes-and-structs/how-to-implement-a-lightweight-class-with-auto-implemented-properties.md +++ b/docs/csharp/programming-guide/classes-and-structs/how-to-implement-a-lightweight-class-with-auto-implemented-properties.md @@ -1,15 +1,15 @@ --- -title: "How to implement a lightweight class with auto-implemented properties" -description: Learn how to create an immutable lightweight class in C# that encapsulates auto-implemented properties. There are two implementation approaches. +title: "How to implement a lightweight class with automatically implemented properties" +description: Learn how to create an immutable lightweight class in C# that encapsulates automatically implemented properties. There are two implementation approaches. ms.date: 07/29/2022 helpviewer_keywords: - "auto-implemented properties [C#]" - "properties [C#], auto-implemented" ms.topic: how-to --- -# How to implement a lightweight class with auto-implemented properties (C# Programming Guide) +# How to implement a lightweight class with automatically implemented properties -This example shows how to create an immutable lightweight class that serves only to encapsulate a set of auto-implemented properties. Use this kind of construct instead of a struct when you must use reference type semantics. +This example shows how to create an immutable lightweight class that serves only to encapsulate a set of automatically implemented properties. Use this kind of construct instead of a struct when you must use reference type semantics. You can make an immutable property in the following ways: @@ -44,7 +44,7 @@ class Contact ## Example -The following example shows two ways to implement an immutable class that has auto-implemented properties. Each way declares one of the properties with a private `set` and one of the properties with a `get` only. The first class uses a constructor only to initialize the properties, and the second class uses a static factory method that calls a constructor. +The following example shows two ways to implement an immutable class that has automatically implemented properties. Each way declares one of the properties with a private `set` and one of the properties with a `get` only. The first class uses a constructor only to initialize the properties, and the second class uses a static factory method that calls a constructor. ```csharp // This class is immutable. After an object is created, @@ -135,7 +135,7 @@ public class Program */ ``` -The compiler creates backing fields for each auto-implemented property. The fields aren't accessible directly from source code. +The compiler creates backing fields for each automatically implemented property. The fields aren't accessible directly from source code. ## See also diff --git a/docs/csharp/programming-guide/classes-and-structs/interface-properties.md b/docs/csharp/programming-guide/classes-and-structs/interface-properties.md index 154a6e4ce55ba..6b3c47c67f803 100644 --- a/docs/csharp/programming-guide/classes-and-structs/interface-properties.md +++ b/docs/csharp/programming-guide/classes-and-structs/interface-properties.md @@ -12,7 +12,7 @@ Properties can be declared on an [interface](../../language-reference/keywords/i :::code language="csharp" source="./snippets/properties/interfaces.cs" id="SnippetDeclareInterfaceProperties"::: -Interface properties typically don't have a body. The accessors indicate whether the property is read-write, read-only, or write-only. Unlike in classes and structs, declaring the accessors without a body doesn't declare an [auto-implemented property](auto-implemented-properties.md). An interface can define a default implementation for members, including properties. Defining a default implementation for a property in an interface is rare because interfaces can't define instance data fields. +Interface properties typically don't have a body. The accessors indicate whether the property is read-write, read-only, or write-only. Unlike in classes and structs, declaring the accessors without a body doesn't declare an [automatically implemented property](auto-implemented-properties.md). An interface can define a default implementation for members, including properties. Defining a default implementation for a property in an interface is rare because interfaces can't define instance data fields. ## Example diff --git a/docs/csharp/programming-guide/classes-and-structs/object-and-collection-initializers.md b/docs/csharp/programming-guide/classes-and-structs/object-and-collection-initializers.md index ecdd250285c5f..23aa132ff0ed6 100644 --- a/docs/csharp/programming-guide/classes-and-structs/object-and-collection-initializers.md +++ b/docs/csharp/programming-guide/classes-and-structs/object-and-collection-initializers.md @@ -12,7 +12,7 @@ C# lets you instantiate an object or collection and perform member assignments i ## Object initializers -Object initializers let you assign values to any accessible fields or properties of an object at creation time without having to invoke a constructor followed by lines of assignment statements. The object initializer syntax enables you to specify arguments for a constructor or omit the arguments (and parentheses syntax). The following example shows how to use an object initializer with a named type, `Cat` and how to invoke the parameterless constructor. Note the use of autoimplemented properties in the `Cat` class. For more information, see [Auto-Implemented Properties](auto-implemented-properties.md). +Object initializers let you assign values to any accessible fields or properties of an object at creation time without having to invoke a constructor followed by lines of assignment statements. The object initializer syntax enables you to specify arguments for a constructor or omit the arguments (and parentheses syntax). The following example shows how to use an object initializer with a named type, `Cat` and how to invoke the parameterless constructor. Note the use of autoimplemented properties in the `Cat` class. For more information, see [Automatically implemented properties](auto-implemented-properties.md). :::code language="csharp" source="./snippets/object-collection-initializers/BasicObjectInitializers.cs" id="CatDeclaration"::: :::code language="csharp" source="./snippets/object-collection-initializers/BasicObjectInitializers.cs" id="ObjectPropertyInitialization"::: diff --git a/docs/csharp/programming-guide/classes-and-structs/partial-classes-and-methods.md b/docs/csharp/programming-guide/classes-and-structs/partial-classes-and-methods.md index 2bd6cb8ffe709..d56e16e8aeb3d 100644 --- a/docs/csharp/programming-guide/classes-and-structs/partial-classes-and-methods.md +++ b/docs/csharp/programming-guide/classes-and-structs/partial-classes-and-methods.md @@ -112,7 +112,7 @@ An implementation isn't required for a partial method when the signature obeys t The method and all calls to the method are removed at compile time when there's no implementation. -Any method that doesn't conform to all those restrictions, including properties and indexers, must provide an implementation. That implementation might be supplied by a *source generator*. [Partial properties](../../language-reference/keywords/partial-member.md) can't be implemented using auto-implemented properties. The compiler can't distinguish between an auto-implemented property, and the declaring declaration of a partial property. +Any method that doesn't conform to all those restrictions, including properties and indexers, must provide an implementation. That implementation might be supplied by a *source generator*. [Partial properties](../../language-reference/keywords/partial-member.md) can't be implemented using automatically implemented properties. The compiler can't distinguish between an automatically implemented property, and the declaring declaration of a partial property. Partial methods enable the implementer of one part of a class to declare a member. The implementer of another part of the class can define that member. There are two scenarios where this separation is useful: templates that generate boilerplate code, and source generators. diff --git a/docs/csharp/programming-guide/classes-and-structs/properties.md b/docs/csharp/programming-guide/classes-and-structs/properties.md index a05aae227a524..a6a9a2b98764b 100644 --- a/docs/csharp/programming-guide/classes-and-structs/properties.md +++ b/docs/csharp/programming-guide/classes-and-structs/properties.md @@ -14,13 +14,13 @@ A *property* is a member that provides a flexible mechanism to read, write, or c :::code language="csharp" source="./snippets/properties/Person.cs" id="Field"::: -## Auto-implemented properties +## Automatically implemented properties A property definition contains declarations for a `get` and `set` accessor that retrieves and assigns the value of that property: :::code language="csharp" source="./snippets/properties/Person.cs" id="AutoImplemented"::: -The preceding example shows an *auto-implemented property*. The compiler generates a hidden backing field for the property. The compiler also implements the body of the `get` and `set` accessors. Any attributes are applied to the auto-implemented property. You can apply the attribute to the compiler-generated backing field by specifying the `field:` tag on the attribute. +The preceding example shows an *automatically implemented property*. The compiler generates a hidden backing field for the property. The compiler also implements the body of the `get` and `set` accessors. Any attributes are applied to the automatically implemented property. You can apply the attribute to the compiler-generated backing field by specifying the `field:` tag on the attribute. You can initialize a property to a value other than the default by setting a value after the closing brace for the property. You might prefer the initial value for the `FirstName` property to be the empty string rather than `null`. You would specify that as shown in the following code: @@ -39,7 +39,7 @@ You can add any restrictive access modifier to either the set or get accessors. There are two special access modifiers for `set` accessors: - A `set` accessor can have `init` as its access modifier. That `set` accessor can be called only from an object initializer or the type's constructors. It's more restrictive than `private` on the `set` accessor. -- An auto-implemented property can declare a `get` accessor without a `set` accessor. In that case, the compiler allows the `set` accessor to be called only from the type's constructors. It's more restrictive than the `init` accessor on the `set` accessor. +- An automatically implemented property can declare a `get` accessor without a `set` accessor. In that case, the compiler allows the `set` accessor to be called only from the type's constructors. It's more restrictive than the `init` accessor on the `set` accessor. Modify the `Person` class so as follows: @@ -86,13 +86,13 @@ This implementation works because the `FirstName` and `LastName` properties are This final version evaluates the `FullName` property only when needed. The previously calculated version is used if valid. Otherwise, the calculation updates the cached value. Developers using this class don't need to know the details of the implementation. None of these internal changes affect the use of the Person object. -Beginning with C# 13, you can create [`partial` properties](../../language-reference/keywords/partial-member.md) in `partial` classes. The implementing declaration for a `partial` property can't be an auto-implemented property. An auto-implemented property uses the same syntax as a declaring partial property declaration. +Beginning with C# 13, you can create [`partial` properties](../../language-reference/keywords/partial-member.md) in `partial` classes. The implementing declaration for a `partial` property can't be an automatically implemented property. An automatically implemented property uses the same syntax as a declaring partial property declaration. ## Properties Properties are a form of smart fields in a class or object. From outside the object, they appear like fields in the object. However, properties can be implemented using the full palette of C# functionality. You can provide validation, different accessibility, lazy evaluation, or any requirements your scenarios need. -- Simple properties that require no custom accessor code can be implemented either as expression body definitions or as [auto-implemented properties](./auto-implemented-properties.md). +- Simple properties that require no custom accessor code can be implemented either as expression body definitions or as [automatically implemented properties](./auto-implemented-properties.md). - Properties enable a class to expose a public way of getting and setting values, while hiding implementation or verification code. - A [get](../../language-reference/keywords/get.md) property accessor is used to return the property value, and a [set](../../language-reference/keywords/set.md) property accessor is used to assign a new value. An [init](../../language-reference/keywords/init.md) property accessor is used to assign a new value only during object construction. These accessors can have different access levels. For more information, see [Restricting Accessor Accessibility](./restricting-accessor-accessibility.md). - The [value](../../language-reference/keywords/value.md) keyword is used to define the value the `set` or `init` accessor is assigning. diff --git a/docs/csharp/programming-guide/classes-and-structs/restricting-accessor-accessibility.md b/docs/csharp/programming-guide/classes-and-structs/restricting-accessor-accessibility.md index 5cb902b128f56..ef533d738fe03 100644 --- a/docs/csharp/programming-guide/classes-and-structs/restricting-accessor-accessibility.md +++ b/docs/csharp/programming-guide/classes-and-structs/restricting-accessor-accessibility.md @@ -20,7 +20,7 @@ The [get](../../language-reference/keywords/get.md) and [set](../../language-ref In this example, a property called `Name` defines a `get` and `set` accessor. The `get` accessor receives the accessibility level of the property itself, `public` in this case, while the `set` accessor is explicitly restricted by applying the [protected](../../language-reference/keywords/protected.md) access modifier to the accessor itself. > [!NOTE] -> The examples in this article don't use [auto-implemented properties](./properties.md#auto-implemented-properties). *Auto-implemented properties* provide a concise syntax for declaring properties when a custom backing field isn't required. +> The examples in this article don't use [automatically implemented properties](./properties.md#automatically-implemented-properties). *Automatically implemented properties* provide a concise syntax for declaring properties when a custom backing field isn't required. ## Restrictions on Access Modifiers on Accessors diff --git a/docs/csharp/programming-guide/classes-and-structs/snippets/object-collection-initializers/BasicObjectInitializers.cs b/docs/csharp/programming-guide/classes-and-structs/snippets/object-collection-initializers/BasicObjectInitializers.cs index 56087f7ca8e64..cabbd0000b732 100644 --- a/docs/csharp/programming-guide/classes-and-structs/snippets/object-collection-initializers/BasicObjectInitializers.cs +++ b/docs/csharp/programming-guide/classes-and-structs/snippets/object-collection-initializers/BasicObjectInitializers.cs @@ -6,7 +6,7 @@ public class BasicObjectInitializers // public class Cat { - // Auto-implemented properties. + // Automatically implemented properties. public int Age { get; set; } public string? Name { get; set; } @@ -151,7 +151,7 @@ public class InitializationSample { public class Cat { - // Auto-implemented properties. + // Automatically implemented properties. public int Age { get; set; } public string? Name { get; set; } diff --git a/docs/csharp/programming-guide/classes-and-structs/using-properties.md b/docs/csharp/programming-guide/classes-and-structs/using-properties.md index cc3547af48848..340333b00667e 100644 --- a/docs/csharp/programming-guide/classes-and-structs/using-properties.md +++ b/docs/csharp/programming-guide/classes-and-structs/using-properties.md @@ -23,11 +23,11 @@ Properties are declared in the class block by specifying the access level of the :::code language="csharp" source="./snippets/properties/TimePeriod.cs" id="UsingExample"::: -In this example, `Month` is declared as a property so that the `set` accessor can make sure that the `Month` value is set between 1 and 12. The `Month` property uses a private field to track the actual value. The real location of a property's data is often referred to as the property's "backing store." It's common for properties to use private fields as a backing store. The field is marked private in order to make sure that it can only be changed by calling the property. For more information about public and private access restrictions, see [Access Modifiers](./access-modifiers.md). Auto-implemented properties provide simplified syntax for simple property declarations. For more information, see [Auto-Implemented Properties](auto-implemented-properties.md). +In this example, `Month` is declared as a property so that the `set` accessor can make sure that the `Month` value is set between 1 and 12. The `Month` property uses a private field to track the actual value. The real location of a property's data is often referred to as the property's "backing store." It's common for properties to use private fields as a backing store. The field is marked private in order to make sure that it can only be changed by calling the property. For more information about public and private access restrictions, see [Access Modifiers](./access-modifiers.md). Automatically implemented properties provide simplified syntax for simple property declarations. For more information, see [Automatically implemented properties](auto-implemented-properties.md). ## The get accessor -The body of the `get` accessor resembles that of a method. It must return a value of the property type. The C# compiler and Just-in-time (JIT) compiler detect common patterns for implementing the `get` accessor, and optimizes those patterns. For example, a `get` accessor that returns a field without performing any computation is likely optimized to a memory read of that field. Auto-implemented properties follow this pattern and benefit from these optimizations. However, a virtual `get` accessor method can't be inlined because the compiler doesn't know at compile time which method might actually be called at run time. The following example shows a `get` accessor that returns the value of a private field `_name`: +The body of the `get` accessor resembles that of a method. It must return a value of the property type. The C# compiler and Just-in-time (JIT) compiler detect common patterns for implementing the `get` accessor, and optimizes those patterns. For example, a `get` accessor that returns a field without performing any computation is likely optimized to a memory read of that field. Automatically mplemented properties follow this pattern and benefit from these optimizations. However, a virtual `get` accessor method can't be inlined because the compiler doesn't know at compile time which method might actually be called at run time. The following example shows a `get` accessor that returns the value of a private field `_name`: :::code language="csharp" source="./snippets/properties/Person.cs" id="UsingEmployeeExample"::: @@ -106,5 +106,5 @@ In this example, two classes, `Cube` and `Square`, implement an abstract class, - [Properties](properties.md) - [Interface properties](interface-properties.md) -- [Auto-implemented properties](auto-implemented-properties.md) +- [Automatically implemented properties](auto-implemented-properties.md) - [Partial properties](../../language-reference/keywords/partial-member.md) diff --git a/docs/csharp/programming-guide/indexers/comparison-between-properties-and-indexers.md b/docs/csharp/programming-guide/indexers/comparison-between-properties-and-indexers.md index f0cb88ca3652c..18e596e67afa8 100644 --- a/docs/csharp/programming-guide/indexers/comparison-between-properties-and-indexers.md +++ b/docs/csharp/programming-guide/indexers/comparison-between-properties-and-indexers.md @@ -18,7 +18,7 @@ Indexers are like properties. Except for the differences shown in the following |Can be a static or an instance member.|Must be an instance member.| |A [get](../../language-reference/keywords/get.md) accessor of a property has no parameters.|A `get` accessor of an indexer has the same formal parameter list as the indexer.| |A [set](../../language-reference/keywords/set.md) accessor of a property contains the implicit `value` parameter.|A `set` accessor of an indexer has the same formal parameter list as the indexer, and also to the [value](../../language-reference/keywords/value.md) parameter.| -|Supports shortened syntax with [Auto-Implemented Properties](../classes-and-structs/auto-implemented-properties.md).|Supports expression bodied members for get only indexers.| +|Supports shortened syntax with [Automatically implemented properties](../classes-and-structs/auto-implemented-properties.md).|Supports expression bodied members for get only indexers.| ## See also diff --git a/docs/csharp/programming-guide/indexers/index.md b/docs/csharp/programming-guide/indexers/index.md index 91b9b4bbb46d5..c663e77b2c0ee 100644 --- a/docs/csharp/programming-guide/indexers/index.md +++ b/docs/csharp/programming-guide/indexers/index.md @@ -33,7 +33,7 @@ Indexers enable *indexed* properties: properties referenced using one or more ar - Indexers can have one or more formal parameters, for example, when accessing a two-dimensional array. - You can declare [`partial` indexers](../../language-reference/keywords/partial-member.md) in [`partial` types](../../language-reference/keywords/partial-type.md). -You can apply almost everything you learned from working with properties to indexers. The only exception to that rule is *auto implemented properties*. The compiler can't always generate the correct storage for an indexer. You can define multiple indexers on a type, as long as the argument lists for each indexer is unique. +You can apply almost everything you learned from working with properties to indexers. The only exception to that rule is *automatically implemented properties*. The compiler can't always generate the correct storage for an indexer. You can define multiple indexers on a type, as long as the argument lists for each indexer is unique. ## Uses of indexers diff --git a/docs/csharp/toc.yml b/docs/csharp/toc.yml index ebd9c33e81733..f5bfd4d674be0 100644 --- a/docs/csharp/toc.yml +++ b/docs/csharp/toc.yml @@ -545,9 +545,9 @@ items: href: programming-guide/classes-and-structs/restricting-accessor-accessibility.md - name: "How to declare and use read write properties" href: programming-guide/classes-and-structs/how-to-declare-and-use-read-write-properties.md - - name: Auto-Implemented Properties + - name: Automatically implemented properties href: programming-guide/classes-and-structs/auto-implemented-properties.md - - name: "How to implement a lightweight class with auto-implemented properties" + - name: "How to implement a lightweight class with automatically implemented properties" href: programming-guide/classes-and-structs/how-to-implement-a-lightweight-class-with-auto-implemented-properties.md - name: Methods items: diff --git a/docs/csharp/whats-new/csharp-version-history.md b/docs/csharp/whats-new/csharp-version-history.md index e9b77d444bc41..862053352cd95 100644 --- a/docs/csharp/whats-new/csharp-version-history.md +++ b/docs/csharp/whats-new/csharp-version-history.md @@ -220,7 +220,7 @@ The following enhancements were made to existing features: - You can test `==` and `!=` with tuple types. - You can use expression variables in more locations. -- You can attach attributes to the backing field of auto-implemented properties. +- You can attach attributes to the backing field of automatically implemented properties. - Method resolution when arguments differ by `in` was improved. - Overload resolution now has fewer ambiguous cases. diff --git a/docs/fsharp/language-reference/members/explicit-fields-the-val-keyword.md b/docs/fsharp/language-reference/members/explicit-fields-the-val-keyword.md index a9fe5c7666982..52c2c9f1944ac 100644 --- a/docs/fsharp/language-reference/members/explicit-fields-the-val-keyword.md +++ b/docs/fsharp/language-reference/members/explicit-fields-the-val-keyword.md @@ -5,7 +5,7 @@ ms.date: 08/15/2020 --- # Explicit Fields: The val Keyword -The `val` keyword is used to declare a location to store a value in a class or structure type, without initializing it. Storage locations declared in this manner are called *explicit fields*. Another use of the `val` keyword is in conjunction with the `member` keyword to declare an auto-implemented property. For more information on auto-implemented properties, see [Properties](properties.md). +The `val` keyword is used to declare a location to store a value in a class or structure type, without initializing it. Storage locations declared in this manner are called *explicit fields*. Another use of the `val` keyword is in conjunction with the `member` keyword to declare an automatically implemented property. For more information on automatically implemented properties, see [Properties](properties.md). ## Syntax diff --git a/docs/fundamentals/code-analysis/style-rules/ide0032.md b/docs/fundamentals/code-analysis/style-rules/ide0032.md index 9d468917b3fcc..2a9ee2bad42d4 100644 --- a/docs/fundamentals/code-analysis/style-rules/ide0032.md +++ b/docs/fundamentals/code-analysis/style-rules/ide0032.md @@ -28,7 +28,7 @@ dev_langs: ## Overview -This style rule concerns the use of [auto-implemented properties](../../../csharp/programming-guide/classes-and-structs/auto-implemented-properties.md) versus properties with private backing fields. +This style rule concerns the use of [automatically implemented properties](../../../csharp/programming-guide/classes-and-structs/auto-implemented-properties.md) versus properties with private backing fields. ## Options @@ -39,7 +39,7 @@ Options specify the behavior that you want the rule to enforce. For information | Property | Value | Description | |--------------------------|-------------------------------------|-----------------------------------------------| | **Option name** | dotnet_style_prefer_auto_properties | | -| **Option values** | `true` | Prefer auto-implemented properties | +| **Option values** | `true` | Prefer automatically implemented properties | | | `false` | Prefer properties with private backing fields | | **Default option value** | `true` | | diff --git a/docs/standard/serialization/binaryformatter-migration-guide/functionality-reference.md b/docs/standard/serialization/binaryformatter-migration-guide/functionality-reference.md index 817cb923b350e..25a4e5374997a 100644 --- a/docs/standard/serialization/binaryformatter-migration-guide/functionality-reference.md +++ b/docs/standard/serialization/binaryformatter-migration-guide/functionality-reference.md @@ -24,7 +24,7 @@ In most common scenario, the type is annotated with `[Serializable]` and the ser ### C# auto properties -For C# [auto-implemented properties](../../../csharp/programming-guide/classes-and-structs/auto-implemented-properties.md) (`{ get; set; }`), BinaryFormatter will serialize the backing fields that are generated by the C# compiler, not the properties. The names of those serialized backing fields contain illegal C# characters and cannot be controlled. A C# decompiler (such as [https://sharplab.io/](https://sharplab.io/) or [ILSpy](https://github.com/icsharpcode/ILSpy)) can demonstrate how C# auto properties are presented to the runtime. +For C# [automatically implemented properties](../../../csharp/programming-guide/classes-and-structs/auto-implemented-properties.md) (`{ get; set; }`), BinaryFormatter will serialize the backing fields that are generated by the C# compiler, not the properties. The names of those serialized backing fields contain illegal C# characters and cannot be controlled. A C# decompiler (such as [https://sharplab.io/](https://sharplab.io/) or [ILSpy](https://github.com/icsharpcode/ILSpy)) can demonstrate how C# auto properties are presented to the runtime. ```csharp [Serializable] diff --git a/docs/visual-basic/language-reference/statements/property-statement.md b/docs/visual-basic/language-reference/statements/property-statement.md index 834e2002cd343..43fb00a482822 100644 --- a/docs/visual-basic/language-reference/statements/property-statement.md +++ b/docs/visual-basic/language-reference/statements/property-statement.md @@ -135,7 +135,7 @@ Property name ( [ parameterlist ] ) [ As returntype ] [ Implements implementslis - `Get` - Optional. Required if the property is marked `ReadOnly`. Starts a `Get` property procedure that is used to return the value of the property. The `Get` statement is not used with [auto-implemented properties](../../programming-guide/language-features/procedures/auto-implemented-properties.md). + Optional. Required if the property is marked `ReadOnly`. Starts a `Get` property procedure that is used to return the value of the property. The `Get` statement is not used with [automatically implemented properties](../../programming-guide/language-features/procedures/auto-implemented-properties.md). - `statements` @@ -147,7 +147,7 @@ Property name ( [ parameterlist ] ) [ As returntype ] [ Implements implementslis - `Set` - Optional. Required if the property is marked `WriteOnly`. Starts a `Set` property procedure that is used to store the value of the property. The `Set` statement is not used with [auto-implemented properties](../../programming-guide/language-features/procedures/auto-implemented-properties.md). + Optional. Required if the property is marked `WriteOnly`. Starts a `Set` property procedure that is used to store the value of the property. The `Set` statement is not used with [automatically implemented properties](../../programming-guide/language-features/procedures/auto-implemented-properties.md). - `End Set` @@ -159,7 +159,7 @@ Property name ( [ parameterlist ] ) [ As returntype ] [ Implements implementslis ## Remarks -The `Property` statement introduces the declaration of a property. A property can have a `Get` procedure (read only), a `Set` procedure (write only), or both (read-write). You can omit the `Get` and `Set` procedure when using an auto-implemented property. For more information, see [Auto-Implemented Properties](../../programming-guide/language-features/procedures/auto-implemented-properties.md). +The `Property` statement introduces the declaration of a property. A property can have a `Get` procedure (read only), a `Set` procedure (write only), or both (read-write). You can omit the `Get` and `Set` procedure when using an automatically implemented property. For more information, see [Automatically implemented properties](../../programming-guide/language-features/procedures/auto-implemented-properties.md). You can use `Property` only at class level. This means the *declaration context* for a property must be a class, structure, module, or interface, and cannot be a source file, namespace, procedure, or block. For more information, see [Declaration Contexts and Default Access Levels](declaration-contexts-and-default-access-levels.md). @@ -207,7 +207,7 @@ The following example declares a property in a class. ## See also -- [Auto-Implemented Properties](../../programming-guide/language-features/procedures/auto-implemented-properties.md) +- [Automatically implemented properties](../../programming-guide/language-features/procedures/auto-implemented-properties.md) - [Objects and Classes](../../programming-guide/language-features/objects-and-classes/index.md) - [Get Statement](get-statement.md) - [Set Statement](set-statement.md) diff --git a/docs/visual-basic/misc/bc36714.md b/docs/visual-basic/misc/bc36714.md index 4767eb884d561..bf161ba082d86 100644 --- a/docs/visual-basic/misc/bc36714.md +++ b/docs/visual-basic/misc/bc36714.md @@ -17,22 +17,22 @@ An auto-implemented property can be initialized as part of its declaration, but ## To correct this error -- Either use an auto-implemented property or remove the initialization from the property declaration. +- Either use an automatically implemented property or remove the initialization from the property declaration. ## Example - The following examples show both auto-implemented and expanded properties. Auto-implemented properties can be initialized by using assignment or a `New` clause, but expanded properties cannot be. + The following examples show both automatically implemented and expanded properties. Automatically implemented properties can be initialized by using assignment or a `New` clause, but expanded properties cannot be. ```vb Class AutoImplementedExample - ' An auto-implemented property can be assigned an initial value. + ' An automatically implemented property can be assigned an initial value. Property IDNum As Integer = 33542 - ' An auto-implemented property can be initialized with New. + ' An automatically implemented property can be initialized with New. Property Name As New String("Don Hall") End Class Class ExpandedExample - ' Attempting to expand an initialized auto-implemented property + ' Attempting to expand an initialized automatically implemented property ' causes this error. 'Property IDNum As Integer = 33542 ' Get @@ -54,6 +54,6 @@ End Class ## See also -- [Auto-Implemented Properties](../programming-guide/language-features/procedures/auto-implemented-properties.md) +- [Automatically implemented properties](../programming-guide/language-features/procedures/auto-implemented-properties.md) - [How to: Create a Property](../programming-guide/language-features/procedures/how-to-create-a-property.md) - [Property Procedures](../programming-guide/language-features/procedures/property-procedures.md) diff --git a/docs/visual-basic/programming-guide/com-interop/walkthrough-office-programming.md b/docs/visual-basic/programming-guide/com-interop/walkthrough-office-programming.md index 124f891ee5944..80e02902ffb3c 100644 --- a/docs/visual-basic/programming-guide/com-interop/walkthrough-office-programming.md +++ b/docs/visual-basic/programming-guide/com-interop/walkthrough-office-programming.md @@ -10,7 +10,7 @@ helpviewer_keywords: --- # Walkthrough: Office Programming in Visual Basic -Visual Studio offers features in Visual Basic that improve Microsoft Office programming. Features in Visual Basic include auto-implemented properties, statements in lambda expressions, and collection initializers. You can embed type information, which allows deployment of assemblies that interact with COM components without deploying primary interop assemblies (PIAs) to the user's computer. For more information, see [Walkthrough: Embedding Types from Managed Assemblies](../../../standard/assembly/embed-types-visual-studio.md). +Visual Studio offers features in Visual Basic that improve Microsoft Office programming. Features in Visual Basic include automatically implemented properties, statements in lambda expressions, and collection initializers. You can embed type information, which allows deployment of assemblies that interact with COM components without deploying primary interop assemblies (PIAs) to the user's computer. For more information, see [Walkthrough: Embedding Types from Managed Assemblies](../../../standard/assembly/embed-types-visual-studio.md). This walkthrough demonstrates these features in the context of Office programming, but many of these features are also useful in general programming. In the walkthrough, you use an Excel Add-in application to create an Excel workbook. Next, you create a Word document that contains a link to the workbook. Finally, you see how to enable and disable the PIA dependency. @@ -58,7 +58,7 @@ You must have Microsoft Office Excel and Microsoft Office Word installed on your 1. In **Solution Explorer**, right-click your project's name, click **Add**, and then click **Class**. Name the class Account.vb. Click **Add**. -2. Replace the definition of the `Account` class with the following code. The class definitions use *auto-implemented properties*. For more information, see [Auto-Implemented Properties](../../../visual-basic/programming-guide/language-features/procedures/auto-implemented-properties.md). +2. Replace the definition of the `Account` class with the following code. The class definitions use *automatically implemented properties*. For more information, see [Automatically implemented properties](../../../visual-basic/programming-guide/language-features/procedures/auto-implemented-properties.md). [!code-vb[csOfficeWalkthrough#2](~/samples/snippets/visualbasic/VS_Snippets_VBCSharp/csofficewalkthrough/vb/account.vb#2)] @@ -139,7 +139,7 @@ You must have Microsoft Office Excel and Microsoft Office Word installed on your ## See also -- [Auto-Implemented Properties (Visual Basic)](../language-features/procedures/auto-implemented-properties.md) +- [Automatically implemented properties (Visual Basic)](../language-features/procedures/auto-implemented-properties.md) - [Collection Initializers](../language-features/collection-initializers/index.md) - [Optional Parameters](../language-features/procedures/optional-parameters.md) - [Passing Arguments by Position and by Name](../language-features/procedures/passing-arguments-by-position-and-by-name.md) diff --git a/docs/visual-basic/programming-guide/concepts/object-oriented-programming.md b/docs/visual-basic/programming-guide/concepts/object-oriented-programming.md index cef4a2354a229..8d86088a2f8cc 100644 --- a/docs/visual-basic/programming-guide/concepts/object-oriented-programming.md +++ b/docs/visual-basic/programming-guide/concepts/object-oriented-programming.md @@ -77,9 +77,9 @@ End Class Properties have get and set procedures, which provide more control on how values are set or returned. -Visual Basic allows you either to create a private field for storing the property value or use so-called auto-implemented properties that create this field automatically behind the scenes and provide the basic logic for the property procedures. +Visual Basic allows you either to create a private field for storing the property value or use so-called automatically implemented properties that create this field automatically behind the scenes and provide the basic logic for the property procedures. -To define an auto-implemented property: +To define an automatically implemented property: ```vb Class SampleClass @@ -105,7 +105,7 @@ Class SampleClass End Class ``` -Most properties have methods or procedures to both set and get the property value. However, you can create read-only or write-only properties to restrict them from being modified or read. In Visual Basic you can use `ReadOnly` and `WriteOnly` keywords. However, auto-implemented properties cannot be read-only or write-only. +Most properties have methods or procedures to both set and get the property value. However, you can create read-only or write-only properties to restrict them from being modified or read. In Visual Basic you can use `ReadOnly` and `WriteOnly` keywords. However, automatically implemented properties cannot be read-only or write-only. For more information, see: diff --git a/docs/visual-basic/programming-guide/language-features/collection-initializers/index.md b/docs/visual-basic/programming-guide/language-features/collection-initializers/index.md index 4ed132b036377..b67aaf76ca3e0 100644 --- a/docs/visual-basic/programming-guide/language-features/collection-initializers/index.md +++ b/docs/visual-basic/programming-guide/language-features/collection-initializers/index.md @@ -82,7 +82,7 @@ Only nested value lists from the first level of nesting are sent to the `Add` me - [Arrays](../arrays/index.md) - [Object Initializers: Named and Anonymous Types](../objects-and-classes/object-initializers-named-and-anonymous-types.md) - [New Operator](../../../language-reference/operators/new-operator.md) -- [Auto-Implemented Properties](../procedures/auto-implemented-properties.md) +- [Automatically implemented properties](../procedures/auto-implemented-properties.md) - [How to: Initialize an Array Variable in Visual Basic](../arrays/how-to-initialize-an-array-variable.md) - [Local Type Inference](../variables/local-type-inference.md) - [Anonymous Types](../objects-and-classes/anonymous-types.md) diff --git a/docs/visual-basic/programming-guide/language-features/procedures/auto-implemented-properties.md b/docs/visual-basic/programming-guide/language-features/procedures/auto-implemented-properties.md index b8a27269f9200..28e0a67dd0289 100644 --- a/docs/visual-basic/programming-guide/language-features/procedures/auto-implemented-properties.md +++ b/docs/visual-basic/programming-guide/language-features/procedures/auto-implemented-properties.md @@ -1,6 +1,6 @@ --- -description: "Learn more about: Auto-Implemented Properties (Visual Basic)" -title: "Auto-Implemented Properties" +description: "Learn more about: Automatically implemented properties (Visual Basic)" +title: "Automatically implemented properties" ms.date: 07/20/2015 f1_keywords: - "vb.AutoProperty" @@ -10,19 +10,19 @@ helpviewer_keywords: - "auto-implemented properties [Visual Basic]" ms.assetid: 5c669f0b-cf95-4b4e-ae84-9cc55212ca87 --- -# Auto-Implemented Properties (Visual Basic) +# Automatically implemented properties (Visual Basic) -*Auto-implemented properties* enable you to quickly specify a property of a class without having to write code to `Get` and `Set` the property. When you write code for an auto-implemented property, the Visual Basic compiler automatically creates a private field to store the property variable in addition to creating the associated `Get` and `Set` procedures. +*Automatically implemented properties* enable you to quickly specify a property of a class without having to write code to `Get` and `Set` the property. When you write code for an automatically implemented property, the Visual Basic compiler automatically creates a private field to store the property variable in addition to creating the associated `Get` and `Set` procedures. - With auto-implemented properties, a property, including a default value, can be declared in a single line. The following example shows three property declarations. + With automatically implemented properties, a property, including a default value, can be declared in a single line. The following example shows three property declarations. [!code-vb[VbVbalrAutoImplementedProperties#1](~/samples/snippets/visualbasic/VS_Snippets_VBCSharp/vbvbalrautoimplementedproperties/vb/module1.vb#1)] - An auto-implemented property is equivalent to a property for which the property value is stored in a private field. The following code example shows an auto-implemented property. + An automatically implemented property is equivalent to a property for which the property value is stored in a private field. The following code example shows an automatically implemented property. [!code-vb[VbVbalrAutoImplementedProperties#5](~/samples/snippets/visualbasic/VS_Snippets_VBCSharp/vbvbalrautoimplementedproperties/vb/module1.vb#5)] - The following code example shows the equivalent code for the previous auto-implemented property example. + The following code example shows the equivalent code for the previous automatically implemented property example. [!code-vb[VbVbalrAutoImplementedProperties#2](~/samples/snippets/visualbasic/VS_Snippets_VBCSharp/vbvbalrautoimplementedproperties/vb/module1.vb#2)] @@ -44,7 +44,7 @@ End Class ## Backing Field - When you declare an auto-implemented property, Visual Basic automatically creates a hidden private field called the *backing field* to contain the property value. The backing field name is the auto-implemented property name preceded by an underscore (_). For example, if you declare an auto-implemented property named `ID`, the backing field is named `_ID`. If you include a member of your class that is also named `_ID`, you produce a naming conflict and Visual Basic reports a compiler error. + When you declare an automatically implemented property, Visual Basic automatically creates a hidden private field called the *backing field* to contain the property value. The backing field name is the automatically implemented property name preceded by an underscore (_). For example, if you declare an automatically implemented property named `ID`, the backing field is named `_ID`. If you include a member of your class that is also named `_ID`, you produce a naming conflict and Visual Basic reports a compiler error. The backing field also has the following characteristics: @@ -56,23 +56,23 @@ End Class - The backing field can be accessed from code within the class and from debugging tools such as the Watch window. However, the backing field does not show in an IntelliSense word completion list. -## Initializing an Auto-Implemented Property +## Initializing an automatically implemented property - Any expression that can be used to initialize a field is valid for initializing an auto-implemented property. When you initialize an auto-implemented property, the expression is evaluated and passed to the `Set` procedure for the property. The following code examples show some auto-implemented properties that include initial values. + Any expression that can be used to initialize a field is valid for initializing an automatically implemented property. When you initialize an automatically implemented property, the expression is evaluated and passed to the `Set` procedure for the property. The following code examples show some automatically implemented properties that include initial values. [!code-vb[VbVbalrAutoImplementedProperties#3](~/samples/snippets/visualbasic/VS_Snippets_VBCSharp/vbvbalrautoimplementedproperties/vb/module1.vb#3)] - You cannot initialize an auto-implemented property that is a member of an `Interface`, or one that is marked `MustOverride`. + You cannot initialize an automatically implemented property that is a member of an `Interface`, or one that is marked `MustOverride`. - When you declare an auto-implemented property as a member of a `Structure`, you can only initialize the auto-implemented property if it is marked as `Shared`. + When you declare an automatically implemented property as a member of a `Structure`, you can only initialize the automatically implemented property if it is marked as `Shared`. - When you declare an auto-implemented property as an array, you cannot specify explicit array bounds. However, you can supply a value by using an array initializer, as shown in the following examples. + When you declare an automatically implemented property as an array, you cannot specify explicit array bounds. However, you can supply a value by using an array initializer, as shown in the following examples. [!code-vb[VbVbalrAutoImplementedProperties#4](~/samples/snippets/visualbasic/VS_Snippets_VBCSharp/vbvbalrautoimplementedproperties/vb/module1.vb#4)] ## Property Definitions That Require Standard Syntax - Auto-implemented properties are convenient and support many programming scenarios. However, there are situations in which you cannot use an auto-implemented property and must instead use standard, or *expanded*, property syntax. + Automatically implemented properties are convenient and support many programming scenarios. However, there are situations in which you cannot use an automatically implemented property and must instead use standard, or *expanded*, property syntax. You have to use expanded property-definition syntax if you want to do any one of the following: @@ -88,9 +88,9 @@ End Class - Provide XML comments for the backing field. -## Expanding an Auto-Implemented Property +## Expanding an automatically implemented property - If you have to convert an auto-implemented property to an expanded property that contains a `Get` or `Set` procedure, the Visual Basic Code Editor can automatically generate the `Get` and `Set` procedures and `End Property` statement for the property. The code is generated if you put the cursor on a blank line following the `Property` statement, type a `G` (for `Get`) or an `S` (for `Set`) and press ENTER. The Visual Basic Code Editor automatically generates the `Get` or `Set` procedure for read-only and write-only properties when you press ENTER at the end of a `Property` statement. + If you have to convert an automatically implemented property to an expanded property that contains a `Get` or `Set` procedure, the Visual Basic Code Editor can automatically generate the `Get` and `Set` procedures and `End Property` statement for the property. The code is generated if you put the cursor on a blank line following the `Property` statement, type a `G` (for `Get`) or an `S` (for `Set`) and press ENTER. The Visual Basic Code Editor automatically generates the `Get` or `Set` procedure for read-only and write-only properties when you press ENTER at the end of a `Property` statement. ## See also diff --git a/docs/visual-basic/programming-guide/language-features/procedures/property-procedures.md b/docs/visual-basic/programming-guide/language-features/procedures/property-procedures.md index d49683be1f6aa..aa7280813f6c7 100644 --- a/docs/visual-basic/programming-guide/language-features/procedures/property-procedures.md +++ b/docs/visual-basic/programming-guide/language-features/procedures/property-procedures.md @@ -26,7 +26,7 @@ Visual Basic provides for the following property procedures: You usually define property procedures in pairs, using the `Get` and `Set` statements, but you can define either procedure alone if the property is read-only ([Get Statement](../../../language-reference/statements/get-statement.md)) or write-only ([Set Statement](../../../language-reference/statements/set-statement.md)). -You can omit the `Get` and `Set` procedure when using an auto-implemented property. For more information, see [Auto-Implemented Properties](./auto-implemented-properties.md). +You can omit the `Get` and `Set` procedure when using an automatially implemented property. For more information, see [Automatically implemented properties](./auto-implemented-properties.md). You can define properties in classes, structures, and modules. Properties are `Public` by default, which means you can call them from anywhere in your application that can access the property's container. diff --git a/docs/visual-basic/programming-guide/language-features/procedures/toc.yml b/docs/visual-basic/programming-guide/language-features/procedures/toc.yml index 664f37a45b893..fa05a91b1c43b 100644 --- a/docs/visual-basic/programming-guide/language-features/procedures/toc.yml +++ b/docs/visual-basic/programming-guide/language-features/procedures/toc.yml @@ -22,7 +22,7 @@ - name: Property Procedures href: property-procedures.md items: - - name: Auto-Implemented Properties + - name: Automatically implemented properties href: auto-implemented-properties.md - name: Differences Between Properties and Variables href: differences-between-properties-and-variables.md diff --git a/docs/visual-basic/whats-new/index.md b/docs/visual-basic/whats-new/index.md index 718be0723b742..3125f56dc7a97 100644 --- a/docs/visual-basic/whats-new/index.md +++ b/docs/visual-basic/whats-new/index.md @@ -46,7 +46,7 @@ Visual Basic / Visual Studio 2012\ `Async` and `await` keywords, iterators, caller info attributes Visual Basic, Visual Studio 2010\ -Auto-implemented properties, collection initializers, implicit line continuation, dynamic, generic co/contra variance, global namespace access +Automatically implemented properties, collection initializers, implicit line continuation, dynamic, generic co/contra variance, global namespace access Visual Basic / Visual Studio 2008\ Language Integrated Query (LINQ), XML literals, local type inference, object initializers, anonymous types, extension methods, local `var` type inference, lambda expressions, `if` operator, partial methods, nullable value types diff --git a/samples/snippets/csharp/VS_Snippets_VBCSharp/csProgGuideLINQ/CS/csRef30LangFeatures_2.cs b/samples/snippets/csharp/VS_Snippets_VBCSharp/csProgGuideLINQ/CS/csRef30LangFeatures_2.cs index f9846780024f8..a8647352ae8da 100644 --- a/samples/snippets/csharp/VS_Snippets_VBCSharp/csProgGuideLINQ/CS/csRef30LangFeatures_2.cs +++ b/samples/snippets/csharp/VS_Snippets_VBCSharp/csProgGuideLINQ/CS/csRef30LangFeatures_2.cs @@ -309,7 +309,7 @@ class ObjInitializers // class Cat { - // Auto-implemented properties. + // Automatically implemented properties. public int Age { get; set; } public string Name { get; set; } } diff --git a/samples/snippets/csharp/VS_Snippets_VBCSharp/csProgGuideStatements/CS/Statements.cs b/samples/snippets/csharp/VS_Snippets_VBCSharp/csProgGuideStatements/CS/Statements.cs index f9b4bace15b96..923b8397ceef6 100644 --- a/samples/snippets/csharp/VS_Snippets_VBCSharp/csProgGuideStatements/CS/Statements.cs +++ b/samples/snippets/csharp/VS_Snippets_VBCSharp/csProgGuideStatements/CS/Statements.cs @@ -124,7 +124,7 @@ namespace ValueEquality using System; class TwoDPoint : IEquatable { - // Readonly auto-implemented properties. + // Readonly automatically implemented properties. public int X { get; private set; } public int Y { get; private set; } @@ -394,7 +394,7 @@ namespace ValueEqualityValueTypes using System; struct TwoDPoint : IEquatable { - // Read/write auto-implemented properties. + // Read/write automatically implemented properties. public int X { get; private set; } public int Y { get; private set; } diff --git a/samples/snippets/csharp/VS_Snippets_VBCSharp/csrefKeywordsModifiers/CS/csrefKeywordsModifiers.cs b/samples/snippets/csharp/VS_Snippets_VBCSharp/csrefKeywordsModifiers/CS/csrefKeywordsModifiers.cs index 9e30e9cf65654..8b80452c63b19 100644 --- a/samples/snippets/csharp/VS_Snippets_VBCSharp/csrefKeywordsModifiers/CS/csrefKeywordsModifiers.cs +++ b/samples/snippets/csharp/VS_Snippets_VBCSharp/csrefKeywordsModifiers/CS/csrefKeywordsModifiers.cs @@ -759,7 +759,7 @@ static void Main() // class MyBaseClass { - // virtual auto-implemented property. Overrides can only + // virtual automatically implemented property. Overrides can only // provide specialized behavior if they implement get and set accessors. public virtual string Name { get; set; } @@ -776,7 +776,7 @@ class MyDerivedClass : MyBaseClass { private string _name; - // Override auto-implemented property with ordinary property + // Override automatically implemented property with ordinary property // to provide specialized accessor behavior. public override string Name {