ConvertTo-PowerShell
SYNOPSIS
Converts C# code to PowerShell script.
SYNTAX
PathByPipeline
ConvertTo-PowerShell -CSharpFile <FileInfo> [<CommonParameters>]
Path
ConvertTo-PowerShell -CSharpFilePath <String> [<CommonParameters>]
Text
ConvertTo-PowerShell -CSharpCode <String> [<CommonParameters>]
DESCRIPTION
Converts C# code to PowerShell script.
EXAMPLES
Example 1
PS C:\> ConvertTo-PowerShell -CSharpCode "void CreateDate(int year) { new DateTime(year); }"
Converts the CreateDate method to a PowerShell function.
Example 2
PS C:\> ConvertTo-PowerShell -CSharpFilePath .\*.cs
Converts all the CS files into PowerShell script and returns them as a collection of strings.
Example 3
PS C:\> Get-ChildItem .\*.cs | ConvertTo-PowerShell
Converts all the piped CS files into PowerShell script and returns them as a collection of strings.
PARAMETERS
-CSharpCode
C# code to convert
Type: System.String
Parameter Sets: Text
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-CSharpFilePath
C# file (cs) to convert
Type: System.String
Parameter Sets: Path
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-CSharpFile
C# file (cs) to convert
Type: System.IO.FileInfo
Parameter Sets: PathByPipeline
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.