code-conversion
code-conversion copied to clipboard
Code conversion command line tool for PowerShell and C#
PowerShell to C# Code Conversion
Orginally a feature of PowerShell Pro Tools, this module provides the ability to convert between C# and PowerShell. No license required.
Installation
Install-Module CodeConversion
Usage
Convert from C# to PowerShell
Invoke-CodeConversion -CSharp 'class MyClass {
public object MyMethod()
{
return new Object();
}
}'
<#
Outputs:
function MyMethod
{
return (New-Object -TypeName Object)
}
#>
Convert from PowerShell to C#
Invoke-CodeConversion -PowerShell 'Get-Process'
# Outputs: System.Diagnostics.Process.GetProcesses()