morbitz / code-conversion

Code conversion command line tool for PowerShell and C#

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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()

About

Code conversion command line tool for PowerShell and C#

License:Apache License 2.0


Languages

Language:C# 89.3%Language:PowerShell 10.7%