Skip to content

Instantly share code, notes, and snippets.

@JohnHammond
Created May 3, 2021 23:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JohnHammond/f1900c6292f6a51dbfc3e4b6d53c60d8 to your computer and use it in GitHub Desktop.
Save JohnHammond/f1900c6292f6a51dbfc3e4b6d53c60d8 to your computer and use it in GitHub Desktop.
function b9MW {
Param (
[Parameter(Position = 0, Mandatory = $True)] [Type[]] $feiNr,
[Parameter(Position = 1)] [Type] $owXkZ = [Void]
)
$hawT4 = [AppDomain]::CurrentDomain.DefineDynamicAssembly((New-Object System.Reflection.AssemblyName('ReflectedDelegate')), [System.Reflection.Emit.AssemblyBuilderAccess]::Run).DefineDynamicModule('InMemoryModule', $false).DefineType('MyDelegateType', 'Class, Public, Sealed, AnsiClass, AutoClass', [System.MulticastDelegate])
$hawT4.DefineConstructor('RTSpecialName, HideBySig, Public', [System.Reflection.CallingConventions]::Standard, $feiNr).SetImplementationFlags('Runtime, Managed')
$hawT4.DefineMethod('Invoke', 'Public, HideBySig, NewSlot, Virtual', $owXkZ, $feiNr).SetImplementationFlags('Runtime, Managed')
return $hawT4.CreateType()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment