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
20 changes: 10 additions & 10 deletions reference/5.1/Microsoft.PowerShell.Core/About/about_Ref.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ Describes how to create and use a reference type variable.
You can pass variables to functions _by reference_ or _by value_. When you pass
a variable _by value_, you are passing a copy of the data. When you pass a
variable _by reference_, you are passing a reference to the original value.
This allows the function to change the value of the variable that is passed to
it.Reference types are created using `[ref]`, which is the type accelerator for
the `[System.Management.Automation.PSReference]` type.
This allows the function to change the value of the variable that's passed to
it. Reference types are created using `[ref]`, which is the type accelerator
for the `[System.Management.Automation.PSReference]` type.

The primary purpose of `[ref]` is to enable passing PowerShell variables by
reference to .NET method parameters marked as `ref`, `out`, or `in`. You can
Expand Down Expand Up @@ -83,14 +83,14 @@ When using references, you must use the `Value` property of the `[ref]` type to
access your data.

```powershell
Function Test([ref]$data)
{
function Test {
param([ref]$data)
$data.Value = 3
}
```

To pass a variable to a parameter that expects a reference, you must type
cast your variable as a reference.
To pass a variable to a parameter that expects a reference, you must type cast
your variable as a reference.

> [!IMPORTANT]
> The brackets and parenthesis are BOTH required.
Expand Down Expand Up @@ -183,9 +183,9 @@ Get-ChildItem -File $setPath |

## Difference between `[ref]` and `[System.Management.Automation.PSReference]`

A reference type variable is created using

Even though `[ref]` is a type accelerator for
A reference type variable is created using the `[ref]` type accelerator or by
specifying the `[System.Management.Automation.PSReference]` type directly. Even
though `[ref]` is a type accelerator for
`[System.Management.Automation.PSReference]`, they behave differently.

- When you use `[ref]` to cast a variable, PowerShell creates a reference object
Expand Down
20 changes: 10 additions & 10 deletions reference/7.4/Microsoft.PowerShell.Core/About/about_Ref.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ Describes how to create and use a reference type variable.
You can pass variables to functions _by reference_ or _by value_. When you pass
a variable _by value_, you are passing a copy of the data. When you pass a
variable _by reference_, you are passing a reference to the original value.
This allows the function to change the value of the variable that is passed to
it.Reference types are created using `[ref]`, which is the type accelerator for
the `[System.Management.Automation.PSReference]` type.
This allows the function to change the value of the variable that's passed to
it. Reference types are created using `[ref]`, which is the type accelerator
for the `[System.Management.Automation.PSReference]` type.

The primary purpose of `[ref]` is to enable passing PowerShell variables by
reference to .NET method parameters marked as `ref`, `out`, or `in`. You can
Expand Down Expand Up @@ -83,14 +83,14 @@ When using references, you must use the `Value` property of the `[ref]` type to
access your data.

```powershell
Function Test([ref]$data)
{
function Test {
param([ref]$data)
$data.Value = 3
}
```

To pass a variable to a parameter that expects a reference, you must type
cast your variable as a reference.
To pass a variable to a parameter that expects a reference, you must type cast
your variable as a reference.

> [!IMPORTANT]
> The brackets and parenthesis are BOTH required.
Expand Down Expand Up @@ -183,9 +183,9 @@ Get-ChildItem -File $setPath |

## Difference between `[ref]` and `[System.Management.Automation.PSReference]`

A reference type variable is created using

Even though `[ref]` is a type accelerator for
A reference type variable is created using the `[ref]` type accelerator or by
specifying the `[System.Management.Automation.PSReference]` type directly. Even
though `[ref]` is a type accelerator for
`[System.Management.Automation.PSReference]`, they behave differently.

- When you use `[ref]` to cast a variable, PowerShell creates a reference object
Expand Down
20 changes: 10 additions & 10 deletions reference/7.5/Microsoft.PowerShell.Core/About/about_Ref.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ Describes how to create and use a reference type variable.
You can pass variables to functions _by reference_ or _by value_. When you pass
a variable _by value_, you are passing a copy of the data. When you pass a
variable _by reference_, you are passing a reference to the original value.
This allows the function to change the value of the variable that is passed to
it.Reference types are created using `[ref]`, which is the type accelerator for
the `[System.Management.Automation.PSReference]` type.
This allows the function to change the value of the variable that's passed to
it. Reference types are created using `[ref]`, which is the type accelerator
for the `[System.Management.Automation.PSReference]` type.

The primary purpose of `[ref]` is to enable passing PowerShell variables by
reference to .NET method parameters marked as `ref`, `out`, or `in`. You can
Expand Down Expand Up @@ -83,14 +83,14 @@ When using references, you must use the `Value` property of the `[ref]` type to
access your data.

```powershell
Function Test([ref]$data)
{
function Test {
param([ref]$data)
$data.Value = 3
}
```

To pass a variable to a parameter that expects a reference, you must type
cast your variable as a reference.
To pass a variable to a parameter that expects a reference, you must type cast
your variable as a reference.

> [!IMPORTANT]
> The brackets and parenthesis are BOTH required.
Expand Down Expand Up @@ -183,9 +183,9 @@ Get-ChildItem -File $setPath |

## Difference between `[ref]` and `[System.Management.Automation.PSReference]`

A reference type variable is created using

Even though `[ref]` is a type accelerator for
A reference type variable is created using the `[ref]` type accelerator or by
specifying the `[System.Management.Automation.PSReference]` type directly. Even
though `[ref]` is a type accelerator for
`[System.Management.Automation.PSReference]`, they behave differently.

- When you use `[ref]` to cast a variable, PowerShell creates a reference object
Expand Down