Created
February 18, 2022 06:46
-
-
Save kemokemo/3e5209d9bc7ffb5190d905cd754f3644 to your computer and use it in GitHub Desktop.
PowerShellスクリプトからC#コードを使う例
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public static class Speaker | |
{ | |
public static void Say(string word) | |
{ | |
char[] trimChars = {'/'}; | |
word = word.TrimEnd(trimChars); | |
Console.WriteLine(word + "!"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param($word) | |
$assemblies = ( | |
"System" | |
) | |
$src = Get-Content "say.cs" | Out-String | |
Add-Type -TypeDefinition $src -Language CSharp -ReferencedAssemblies $assemblies | |
[Speaker]::Say($word) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment