.NET のソースコードの扱い方について、サンプルコードを用いて説明します。
function test1 ()
{
$CS = @"
public static string GetDesktopPath
{
get
{
return Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
}
}
"@
$CSDef = Add-Type -MemberDefinition $CS -Name "GetDesktop" -PassThru
return $CSDef::GetDesktopPath
}