Consider the following PowerShell snippet:
$csharpString = @\"
using System;
public sealed class MyClass
{
public MyClass() { }
public override stri
There's a nicer way to do this without incurring the cost of exceptions:
if (-not ("MyClass" -as [type])) {
add-type @"
public class MyClass { }
"@
}
update: well, apparently powershell signals internally with an exception anyway. It has a bad habit of doing this. The interpreter uses SEH to signal with the break and continue keywords, for example.