Here's the MS documentation concerning Add-Type
So I'm trying to add type through command line:
>powershell Add-Type -TypeDefinition "public class T{public static int Add(int a, int b){return (a + b);}}" -Language CSharp
or
>powershell Add-Type -TypeDefinition "@"""public class T{public static int Add(int a, int b){return (a + b);}}"""@" -Language CSharp
or
>powershell Add-Type -TypeDefinition "@"""public class T{public static int Add(int a, int b){return (a + b);}}"""@" -Language CSharp
or
>powershell Add-Type -TypeDefinition @"public class T{public static int Add(int a, int b){return (a + b);}}"@ -Language CSharp
But whatever I try the execution returns an error. Is it possible to add type by calling the powershell through the cmd console? And then execute the added methods?