From 0bb29bf8408dfa8bf0abf920e7b2d115f93a8268 Mon Sep 17 00:00:00 2001 From: Sean Wheeler Date: Mon, 21 Aug 2023 14:29:07 -0500 Subject: [PATCH 1/2] Improve description of Count property --- .../About/about_Intrinsic_Members.md | 19 +++++++++++++++---- .../About/about_Properties.md | 16 ++++++++++++++-- .../About/about_Intrinsic_Members.md | 19 +++++++++++++++---- .../About/about_Properties.md | 16 ++++++++++++++-- .../About/about_Intrinsic_Members.md | 19 +++++++++++++++---- .../About/about_Properties.md | 16 ++++++++++++++-- .../About/about_Intrinsic_Members.md | 19 +++++++++++++++---- .../About/about_Properties.md | 16 ++++++++++++++-- 8 files changed, 116 insertions(+), 24 deletions(-) diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Intrinsic_Members.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Intrinsic_Members.md index ee5cd9044785..e8a3e84c0d53 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Intrinsic_Members.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Intrinsic_Members.md @@ -1,7 +1,7 @@ --- description: Describes automatic members in all PowerShell objects Locale: en-US -ms.date: 01/24/2023 +ms.date: 08/21/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_Inrinsic_Members?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Intrinsic_Members @@ -163,9 +163,20 @@ information on how to use these methods, see [about_Arrays][01]. ## Properties The **Count** and **Length** properties are available to all PowerShell -objects. These are similar to each other but may work differently depending on -the data type. For more information about these properties, see -[about_Properties][04]. +objects, not just collections. These are similar to each other but may work +differently depending on the data type. For example, the **Length** of a string +is the number of characters in the string. The **Count** property is the number +of instances of the object. + +```powershell +PS> $str = 'string' +PS> $str.Length +6 +PS> $str.Count +1 +``` + +For more information about these properties, see [about_Properties][04]. ## Array indexing scalar types diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Properties.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Properties.md index b2703f187d70..188b1860260b 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Properties.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Properties.md @@ -1,7 +1,7 @@ --- description: Describes how to use object properties in PowerShell. Locale: en-US -ms.date: 07/18/2022 +ms.date: 08/21/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_properties?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: about Properties @@ -253,7 +253,7 @@ the collection. ``` Starting in PowerShell 3.0, if you request the **Count** or **Length** property -of zero objects or one object, PowerShell returns the correct value. +of singleton objects that aren't collections. ```powershell (Get-Service Audiosrv).Count @@ -263,6 +263,18 @@ of zero objects or one object, PowerShell returns the correct value. 1 ``` +However, some objects have a **Length** property. For example, the **Length** +of a string is the number of characters in the string. The **Count** property +is the number of instances of the object. + +```powershell +PS> $str = 'string' +PS> $str.Length +6 +PS> $str.Count +1 +``` + If a property exists on the individual objects and on the collection, only the collection's property is returned. diff --git a/reference/7.2/Microsoft.PowerShell.Core/About/about_Intrinsic_Members.md b/reference/7.2/Microsoft.PowerShell.Core/About/about_Intrinsic_Members.md index 25c2462cdf46..bb09b3fed0b7 100644 --- a/reference/7.2/Microsoft.PowerShell.Core/About/about_Intrinsic_Members.md +++ b/reference/7.2/Microsoft.PowerShell.Core/About/about_Intrinsic_Members.md @@ -1,7 +1,7 @@ --- description: Describes automatic members in all PowerShell objects Locale: en-US -ms.date: 01/24/2023 +ms.date: 08/21/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_Inrinsic_Members?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Intrinsic_Members @@ -163,9 +163,20 @@ information on how to use these methods, see [about_Arrays][01]. ## Properties The **Count** and **Length** properties are available to all PowerShell -objects. These are similar to each other but may work differently depending on -the data type. For more information about these properties, see -[about_Properties][04]. +objects, not just collections. These are similar to each other but may work +differently depending on the data type. For example, the **Length** of a string +is the number of characters in the string. The **Count** property is the number +of instances of the object. + +```powershell +PS> $str = 'string' +PS> $str.Length +6 +PS> $str.Count +1 +``` + +For more information about these properties, see [about_Properties][04]. ## Array indexing scalar types diff --git a/reference/7.2/Microsoft.PowerShell.Core/About/about_Properties.md b/reference/7.2/Microsoft.PowerShell.Core/About/about_Properties.md index 15a283fba5a7..bc42f5370b99 100644 --- a/reference/7.2/Microsoft.PowerShell.Core/About/about_Properties.md +++ b/reference/7.2/Microsoft.PowerShell.Core/About/about_Properties.md @@ -1,7 +1,7 @@ --- description: Describes how to use object properties in PowerShell. Locale: en-US -ms.date: 07/18/2022 +ms.date: 08/21/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_properties?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 title: about Properties @@ -253,7 +253,7 @@ the collection. ``` Starting in PowerShell 3.0, if you request the **Count** or **Length** property -of zero objects or one object, PowerShell returns the correct value. +of singleton objects that aren't collections. ```powershell (Get-Service Audiosrv).Count @@ -263,6 +263,18 @@ of zero objects or one object, PowerShell returns the correct value. 1 ``` +However, some objects have a **Length** property. For example, the **Length** +of a string is the number of characters in the string. The **Count** property +is the number of instances of the object. + +```powershell +PS> $str = 'string' +PS> $str.Length +6 +PS> $str.Count +1 +``` + If a property exists on the individual objects and on the collection, only the collection's property is returned. diff --git a/reference/7.3/Microsoft.PowerShell.Core/About/about_Intrinsic_Members.md b/reference/7.3/Microsoft.PowerShell.Core/About/about_Intrinsic_Members.md index 56f378d6cc4b..857f8dff2fb5 100644 --- a/reference/7.3/Microsoft.PowerShell.Core/About/about_Intrinsic_Members.md +++ b/reference/7.3/Microsoft.PowerShell.Core/About/about_Intrinsic_Members.md @@ -1,7 +1,7 @@ --- description: Describes automatic members in all PowerShell objects Locale: en-US -ms.date: 01/24/2023 +ms.date: 08/21/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_Inrinsic_Members?view=powershell-7.3&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Intrinsic_Members @@ -163,9 +163,20 @@ information on how to use these methods, see [about_Arrays][01]. ## Properties The **Count** and **Length** properties are available to all PowerShell -objects. These are similar to each other but may work differently depending on -the data type. For more information about these properties, see -[about_Properties][04]. +objects, not just collections. These are similar to each other but may work +differently depending on the data type. For example, the **Length** of a string +is the number of characters in the string. The **Count** property is the number +of instances of the object. + +```powershell +PS> $str = 'string' +PS> $str.Length +6 +PS> $str.Count +1 +``` + +For more information about these properties, see [about_Properties][04]. ## Array indexing scalar types diff --git a/reference/7.3/Microsoft.PowerShell.Core/About/about_Properties.md b/reference/7.3/Microsoft.PowerShell.Core/About/about_Properties.md index 8d1c00243393..645983eecf61 100644 --- a/reference/7.3/Microsoft.PowerShell.Core/About/about_Properties.md +++ b/reference/7.3/Microsoft.PowerShell.Core/About/about_Properties.md @@ -1,7 +1,7 @@ --- description: Describes how to use object properties in PowerShell. Locale: en-US -ms.date: 07/18/2022 +ms.date: 08/21/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_properties?view=powershell-7.3&WT.mc_id=ps-gethelp schema: 2.0.0 title: about Properties @@ -254,7 +254,7 @@ the collection. ``` Starting in PowerShell 3.0, if you request the **Count** or **Length** property -of zero objects or one object, PowerShell returns the correct value. +of singleton objects that aren't collections. ```powershell (Get-Service Audiosrv).Count @@ -264,6 +264,18 @@ of zero objects or one object, PowerShell returns the correct value. 1 ``` +However, some objects have a **Length** property. For example, the **Length** +of a string is the number of characters in the string. The **Count** property +is the number of instances of the object. + +```powershell +PS> $str = 'string' +PS> $str.Length +6 +PS> $str.Count +1 +``` + If a property exists on the individual objects and on the collection, only the collection's property is returned. diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Intrinsic_Members.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Intrinsic_Members.md index 7dc5a59fe931..3ebcb35cfcc6 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Intrinsic_Members.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Intrinsic_Members.md @@ -1,7 +1,7 @@ --- description: Describes automatic members in all PowerShell objects Locale: en-US -ms.date: 01/24/2023 +ms.date: 08/21/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_Inrinsic_Members?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: about_Intrinsic_Members @@ -163,9 +163,20 @@ information on how to use these methods, see [about_Arrays][01]. ## Properties The **Count** and **Length** properties are available to all PowerShell -objects. These are similar to each other but may work differently depending on -the data type. For more information about these properties, see -[about_Properties][04]. +objects, not just collections. These are similar to each other but may work +differently depending on the data type. For example, the **Length** of a string +is the number of characters in the string. The **Count** property is the number +of instances of the object. + +```powershell +PS> $str = 'string' +PS> $str.Length +6 +PS> $str.Count +1 +``` + +For more information about these properties, see [about_Properties][04]. ## Array indexing scalar types diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Properties.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Properties.md index 14bd58ad5397..f686bbfb6bfc 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Properties.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Properties.md @@ -1,7 +1,7 @@ --- description: Describes how to use object properties in PowerShell. Locale: en-US -ms.date: 07/18/2022 +ms.date: 08/21/2023 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_properties?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: about Properties @@ -254,7 +254,7 @@ the collection. ``` Starting in PowerShell 3.0, if you request the **Count** or **Length** property -of zero objects or one object, PowerShell returns the correct value. +of singleton objects that aren't collections. ```powershell (Get-Service Audiosrv).Count @@ -264,6 +264,18 @@ of zero objects or one object, PowerShell returns the correct value. 1 ``` +However, some objects have a **Length** property. For example, the **Length** +of a string is the number of characters in the string. The **Count** property +is the number of instances of the object. + +```powershell +PS> $str = 'string' +PS> $str.Length +6 +PS> $str.Count +1 +``` + If a property exists on the individual objects and on the collection, only the collection's property is returned. From 1624c141f4c375326de7decb59a0601a4188e48f Mon Sep 17 00:00:00 2001 From: Sean Wheeler Date: Mon, 21 Aug 2023 16:07:29 -0500 Subject: [PATCH 2/2] fix typo --- .../5.1/Microsoft.PowerShell.Core/About/about_Properties.md | 4 ++-- .../7.2/Microsoft.PowerShell.Core/About/about_Properties.md | 4 ++-- .../7.3/Microsoft.PowerShell.Core/About/about_Properties.md | 4 ++-- .../7.4/Microsoft.PowerShell.Core/About/about_Properties.md | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Properties.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Properties.md index 188b1860260b..b6aad01e3714 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Properties.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Properties.md @@ -252,8 +252,8 @@ the collection. 176 ``` -Starting in PowerShell 3.0, if you request the **Count** or **Length** property -of singleton objects that aren't collections. +Starting in PowerShell 3.0, you can get the **Count** or **Length** property of +singleton objects that aren't collections. ```powershell (Get-Service Audiosrv).Count diff --git a/reference/7.2/Microsoft.PowerShell.Core/About/about_Properties.md b/reference/7.2/Microsoft.PowerShell.Core/About/about_Properties.md index bc42f5370b99..3e84f524cb1d 100644 --- a/reference/7.2/Microsoft.PowerShell.Core/About/about_Properties.md +++ b/reference/7.2/Microsoft.PowerShell.Core/About/about_Properties.md @@ -252,8 +252,8 @@ the collection. 176 ``` -Starting in PowerShell 3.0, if you request the **Count** or **Length** property -of singleton objects that aren't collections. +Starting in PowerShell 3.0, you can get the **Count** or **Length** property of +singleton objects that aren't collections. ```powershell (Get-Service Audiosrv).Count diff --git a/reference/7.3/Microsoft.PowerShell.Core/About/about_Properties.md b/reference/7.3/Microsoft.PowerShell.Core/About/about_Properties.md index 645983eecf61..b9caeea26bcc 100644 --- a/reference/7.3/Microsoft.PowerShell.Core/About/about_Properties.md +++ b/reference/7.3/Microsoft.PowerShell.Core/About/about_Properties.md @@ -253,8 +253,8 @@ the collection. 176 ``` -Starting in PowerShell 3.0, if you request the **Count** or **Length** property -of singleton objects that aren't collections. +Starting in PowerShell 3.0, you can get the **Count** or **Length** property of +singleton objects that aren't collections. ```powershell (Get-Service Audiosrv).Count diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Properties.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Properties.md index f686bbfb6bfc..908704506be7 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Properties.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Properties.md @@ -253,8 +253,8 @@ the collection. 176 ``` -Starting in PowerShell 3.0, if you request the **Count** or **Length** property -of singleton objects that aren't collections. +Starting in PowerShell 3.0, you can get the **Count** or **Length** property of +singleton objects that aren't collections. ```powershell (Get-Service Audiosrv).Count