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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions .github/ISSUE_TEMPLATE/Document_New_Feature.md

This file was deleted.

50 changes: 0 additions & 50 deletions .github/ISSUE_TEMPLATE/Documentation_Issue.md

This file was deleted.

42 changes: 42 additions & 0 deletions .github/ISSUE_TEMPLATE/New_Document.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: New Document Request/Idea 🆕
description: Suggest a new document or major rewrite of an existing one.
labels: doc-idea
body:
- type: checkboxes
attributes:
label: Prerequisites
options:
- label: Write a descriptive title.
required: true
- label: Search the existing issues.
required: true
- type: textarea
attributes:
label: Summary of the new document or enhancement
description: >
A clear and concise description of purpose the new document. Why it is needed?
What gap is it filling? Who is the intended audience? What is the intended
scenario being addressed?
placeholder: >
Try formulating it in user story style. 'As a user I need a document about X so that I
can Y.' with X being the problem or scenario and Y being the purpose and/or target audience
for the document.
validations:
required: true
- type: input
attributes:
label: Proposed title
validations:
required: true
- type: input
attributes:
label: Proposed location in the TOC
validations:
required: false
- type: textarea
attributes:
label: List of related articles to link to
description: Provide a list of files that need to be updated.
placeholder: Enter the Docs or GitHub URL to the article to be updated.
validations:
required: false
33 changes: 0 additions & 33 deletions .github/ISSUE_TEMPLATE/New_Document_Request.md

This file was deleted.

39 changes: 39 additions & 0 deletions .github/ISSUE_TEMPLATE/New_Feature.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Describe new feature or change in behavior 🚀
description: Update existing documentation for a change in behavior or add new documentation for a new feature.
labels: doc-idea
body:
- type: checkboxes
attributes:
label: Prerequisites
options:
- label: Write a descriptive title.
required: true
- label: Search the existing issues.
required: true
- type: textarea
attributes:
label: Summary of the new feature or changed behavior
description: >
A clear and concise description of change.
placeholder: >
Describe the impact of the change and examples, if possible. Include new and changed
parameters and changed output. Put code and output inside ``` blocks.
validations:
required: true
- type: textarea
attributes:
label: List of articles that need to be updated
description: Provide a list of files that need to be updated.
placeholder: Enter the Docs or GitHub URL to the article to be updated.
- type: input
attributes:
label: Link to related PR in PowerShell/PowerShell repo
placeholder: PowerShell/PowerShell#12345
validations:
required: true
- type: input
attributes:
label: Link to related Issues in PowerShell/PowerShell repo
placeholder: PowerShell/PowerShell#12345
validations:
required: true
58 changes: 58 additions & 0 deletions .github/ISSUE_TEMPLATE/New_Issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Documentation issue report 🐛
description: Report an issue with current documentation.
labels: doc-bug
body:
- type: markdown
attributes:
value: |
Use this template to report issues with documentation. This can include typos,
technical and factual errors, grammar, spelling, formatting, presentation, etc.

Support questions should be posted to community support forums. See the [Community support](https://docs.microsoft.com/powershell/scripting/community/community-support) page.
- type: checkboxes
attributes:
label: Prerequisites
options:
- label: Write a descriptive title.
required: true
- label: Search the existing issues.
required: true
- label: I am reporting the documentation problem for version of PowerShell I am using.
required: true
- type: dropdown
attributes:
label: Version
description: What version of the documentation is affected? (select all that apply)
multiple: true
options:
- 5.1
- 7.0
- 7.1
- 7.2
- Preview version
validations:
required: true
- type: input
attributes:
label: Link to affected document
placeholder: Enter a GitHub or Docs URL to the article.
validations:
required: true
- type: textarea
attributes:
label: Description of the documentation error
description: >
Describe the error in the documentation. Include details about what you this is wrong.
placeholder: |
Example 3 has invalid parameters.

List of steps, sample code, or failing test to support your claim.
validations:
required: true
- type: textarea
attributes:
label: Suggested fix
description: >
How would you change the document to make it correct.
validations:
required: false
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ PowerShell supports the following arithmetic operators:
| |strings, arrays, and hash tables. |`"file" + "name"` |
| | |`@(1, "one") + @(2.0, "two")`|
| | |`@{"one" = 1} + @{"two" = 2}`|
| +     |Makes a number out of an object   | + 123                       |
| - |Subtracts one value from another |`6 - 2` |
| |value | |
| - |Makes a number a negative number |`-6` |
| - |Calculates the opposite number |`- -6` |
| | |`(Get-Date).AddDays(-1)` |
| * |Multiply numbers or copy strings |`6 * 2` |
| |and arrays the specified number |`@("!") * 4` |
Expand Down Expand Up @@ -178,7 +179,9 @@ operation fails.

The following examples demonstrate the use of the addition and
multiplication operators; in operations that include different object
types. Assume `$array = 1,2,3`:
types.
Assume `$array = 1,2,3`,
`$red = [ConsoleColor]::Red`, `$blue = [ConsoleColor]::Blue`:

|Expression |Result |
|-----------------|-----------------------|
Expand All @@ -187,6 +190,10 @@ types. Assume `$array = 1,2,3`:
|`$array + "file"`|`1`,`2`,`3`,`file` |
|`$array * 2` |`1`,`2`,`3`,`1`,`2`,`3`|
|`"file" * 3` |`filefilefile` |
|`$blue + 3` |`Red` |
|`$red - 3` |`Blue` |
|`$blue - $red` |`-3` |
|`+ '123'` |`123` |

Because the method that is used to evaluate statements is determined by the
leftmost object, addition and multiplication in PowerShell are not strictly
Expand All @@ -201,7 +208,7 @@ The following examples demonstrate this principle:
|`16 + "file"`|`Cannot convert value "file" to type "System.Int32".`|
| |`Error: "Input string was not in a correct format."` |
| |`At line:1 char:1` |
| |+ 16 + "file"` |
| |`+ 16 + "file"` |

Hash tables are a slightly different case. You can add hash tables to
another hash table, as long as, the added hash tables don't have duplicate
Expand Down Expand Up @@ -305,8 +312,7 @@ result without losing precision. For example:

```powershell
2 + 3.1

(2). GetType().FullName
(2).GetType().FullName
(2 + 3.1).GetType().FullName
```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Describes automatic members in all PowerShell objects
Locale: en-US
ms.date: 07/14/2021
ms.date: 11/16/2021
online version: https://docs.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
Expand Down Expand Up @@ -95,4 +95,38 @@ information on how to use these methods, see [about_Arrays](about_Arrays.md).

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](about_Properties.md).
the data type. For more information about these properties, see
[about_Properties](about_Properties.md).

## Array indexing scalar types

When an object is not an indexed collection, using the index operator to access
the first element returns the object itself. Index values beyond the first
element return `$null`.

```
PS> (2)[0]
2
PS> (2)[-1]
2
PS> (2)[1] -eq $null
True
PS> (2)[0,0] -eq $null
True
```

For more information, see [about_Operators](about_Operators.md#index-operator--).

## New() method for types

Beginning in PowerShell 5.0, PowerShell adds a static `New()` method for all
.NET types. The following examples produce the same result.

```powershell
$expression = New-Object -TypeName regex -ArgumentList 'pattern'
$expression = [regex]::new('pattern')
```

Using the `new()` method performs better than using `New-Object`.

For more information, see [about_Classes](about_Classes.md).
Loading