Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#The C# Code starts with @ sign and ends with @ sign.
$CSharpCode = @"
public class ExampleCSharp
{
public string ReturnTheString(string returnString)
{
string Combine = "Your awesome text is : " + returnString;
return Combine;
}
}
"@
#Add the C# code as definition
Add-Type -TypeDefinition $CSharpCode
#Example is the public class
$ExampleCSharpCode = New-Object -TypeName ExampleCSharp
#Run the public string ReturnString to get the results
$ExampleCSharpCode.ReturnTheString("Hello World")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.