ConvertTo-PowerShell

SYNOPSIS

Converts C# code to PowerShell script.

SYNTAX

PathByPipeline

1
ConvertTo-PowerShell -CSharpFile <FileInfo>
Copied!

Path

1
ConvertTo-PowerShell -CSharpFilePath <String>
Copied!

Text

1
ConvertTo-PowerShell -CSharpCode <String>
Copied!

DESCRIPTION

Converts C# code to PowerShell script.

EXAMPLES

Example 1

1
PS C:\> ConvertTo-PowerShell -CSharpCode "void CreateDate(int year) { new DateTime(year); }"
Copied!
Converts the CreateDate method to a PowerShell function.

Example 2

1
PS C:\> ConvertTo-PowerShell -CSharpFilePath .\*.cs
Copied!
Converts all the CS files into PowerShell script and returns them as a collection of strings.

Example 3

1
PS C:\> Get-ChildItem .\*.cs | ConvertTo-PowerShell
Copied!
Converts all the piped CS files into PowerShell script and returns them as a collection of strings.

PARAMETERS

-CSharpCode

C# code to convert
1
Type: String
2
Parameter Sets: Text
3
Aliases:
4
5
Required: True
6
Position: Named
7
Default value: None
8
Accept pipeline input: False
9
Accept wildcard characters: False
Copied!

-CSharpFilePath

C# file (cs) to convert
1
Type: String
2
Parameter Sets: Path
3
Aliases:
4
5
Required: True
6
Position: Named
7
Default value: None
8
Accept pipeline input: False
9
Accept wildcard characters: True
Copied!

-CSharpFile

C# file (cs) to convert
1
Type: FileInfo
2
Parameter Sets: PathByPipeline
3
Aliases:
4
5
Required: True
6
Position: Named
7
Default value: None
8
Accept pipeline input: True (ByValue)
9
Accept wildcard characters: False
Copied!

INPUTS

System.String

OUTPUTS

System.String

NOTES

RELATED LINKS

Last modified 2yr ago