The Add-Type cmdlet adds the class to the session. Because it's using inline source code, the command uses the TypeDefinition parameter to specify the code in the $Source variable. src
Bash:
$Source = @"
public class TestClass{
public static int Add(int a, int b)
{
return a+b;
}
public int Multiply(int a, int b)
{
return a*b;
}
}
"@
Add-Type -TypeDefinition $Source
# call of static method
[TestClass]::Add(4,3)
Read-Host -Prompt 'Press enter to exit..';
#instantiate class and call method
$b = New-Object TestClass
$b.Multiply(4,3);
Read-Host -Prompt 'Press enter to exit..';