Skip to content

Fix example VB code #2084

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 31, 2018
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Each folder in this repo publishes to [MSDN](https://msdn.microsoft.com/en-us/po
* [/dsc/](https://msdn.microsoft.com/en-us/powershell/dsc/) is for the Desired State Configuration feature
* [/gallery/](https://msdn.microsoft.com/powershell/gallery) is for the [PowerShell Gallery](https://www.powershellgallery.com/)
* [/jea/](https://msdn.microsoft.com/powershell/jea/) is for the Just Enough Administration feature
* [/reference/](https://msdn.microsoft.com/powershell/reference/) is for PowerShell module reference across versions 2.0, 3.0, 4.0, 5.0, 5.1, and 6.0
* [/reference/](https://msdn.microsoft.com/powershell/reference/) is for PowerShell module reference across versions 3.0, 4.0, 5.0, 5.1, and 6.0
* This content will be retrieved by the `Get-Help` cmdlet in the future
* [/scripting/](https://msdn.microsoft.com/en-us/powershell/scripting/) is general PowerShell reference content
* [/wmf](https://msdn.microsoft.com/en-us/powershell/wmf/readme) contains release notes for the Windows Management Framework, the package used to distribute new versions of PowerShell to previous versions of Windows.
Expand Down
14 changes: 7 additions & 7 deletions reference/3.0/Microsoft.PowerShell.Utility/Add-Type.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,18 +157,18 @@ The wildcard character allows you to get the correct assembly even when you are
The command uses the **PassThru** parameter to generate objects that represent the classes that are added to the session, and it saves the objects in the $accType variable.
### Example 4
```
PS C:\> Add-Type -Path c:\ps-test\Hello.vb
[VBFromFile]::SayHello(", World")
PS C:\> Add-Type -Path "c:\ps-test\Hello.vb"
PS C:\> [VBFromFile]::SayHello(", World")

# From Hello.vb

Public Class VBFromFile
Public Shared Function SayHello(sourceName As String) As String
Dim myValue As String = "Hello"
return myValue + sourceName
End Function
Public Shared Function SayHello(sourceName As String) As String
Dim myValue As String = "Hello"
return myValue + sourceName
End Function
End Class
PS C:\> [VBFromFile]::SayHello(", World")

Hello, World
```

Expand Down
13 changes: 10 additions & 3 deletions reference/4.0/Microsoft.PowerShell.Utility/Add-Type.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,19 @@ The command uses the **PassThru** parameter to generate objects that represent t

### Example 4
```
PS C:\> Add-Type -Path c:\ps-test\Hello.vb[VBFromFile]::SayHello(", World")
PS C:\> Add-Type -Path "c:\ps-test\Hello.vb"
PS C:\> [VBFromFile]::SayHello(", World")

# From Hello.vb

Public Class VBFromFilePublic Shared Function SayHello(sourceName As String) As StringDim myValue As String = "Hello"return myValue + sourceNameEnd FunctionEnd Class
PS C:\> [VBFromFile]::SayHello(", World")Hello, World
Public Class VBFromFile
Public Shared Function SayHello(sourceName As String) As String
Dim myValue As String = "Hello"
return myValue + sourceName
End Function
End Class

Hello, World
```

This example uses the **Add-Type** cmdlet to add the VBFromFile class that is defined in the Hello.vb file to the current session.
Expand Down
8 changes: 7 additions & 1 deletion reference/5.0/Microsoft.PowerShell.Utility/Add-Type.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,15 @@ The command uses the *PassThru* parameter to generate objects that represent the
```
PS C:\> Add-Type -Path "c:\ps-test\Hello.vb"
PS C:\> [VBFromFile]::SayHello(", World")

# From Hello.vb

Public Class VBFromFilePublic Shared Function SayHello(sourceName As String) As String Dim myValue As String = "Hello" return myValue + sourceName End Function End Class
Public Class VBFromFile
Public Shared Function SayHello(sourceName As String) As String
Dim myValue As String = "Hello"
return myValue + sourceName
End Function
End Class

Hello, World
```
Expand Down
8 changes: 7 additions & 1 deletion reference/5.1/Microsoft.PowerShell.Utility/Add-Type.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,15 @@ The command uses the *PassThru* parameter to generate objects that represent the
```
PS C:\> Add-Type -Path "c:\ps-test\Hello.vb"
PS C:\> [VBFromFile]::SayHello(", World")

# From Hello.vb

Public Class VBFromFilePublic Shared Function SayHello(sourceName As String) As String Dim myValue As String = "Hello" return myValue + sourceName End Function End Class
Public Class VBFromFile
Public Shared Function SayHello(sourceName As String) As String
Dim myValue As String = "Hello"
return myValue + sourceName
End Function
End Class

Hello, World
```
Expand Down
8 changes: 7 additions & 1 deletion reference/6/Microsoft.PowerShell.Utility/Add-Type.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,15 @@ The command uses the *PassThru* parameter to generate objects that represent the
```
PS C:\> Add-Type -Path "c:\ps-test\Hello.vb"
PS C:\> [VBFromFile]::SayHello(", World")

# From Hello.vb

Public Class VBFromFilePublic Shared Function SayHello(sourceName As String) As String Dim myValue As String = "Hello" return myValue + sourceName End Function End Class
Public Class VBFromFile
Public Shared Function SayHello(sourceName As String) As String
Dim myValue As String = "Hello"
return myValue + sourceName
End Function
End Class

Hello, World
```
Expand Down