Last active
November 30, 2019 17:13
-
-
Save Splaxi/0aa55b0fd96e466eea68eea82eeccc56 to your computer and use it in GitHub Desktop.
.NET Reflection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Reflection.Assembly]$ass = [Reflection.Assembly]::LoadFile("C:\Temp\File.dll") | |
$specificType = $ass.GetType("Namespace.Type") | |
$specificType.GetMethods([System.Reflection.BindingFlags]::NonPublic -bor [System.Reflection.BindingFlags]::Instance) | |
$instanceTypeObj = [System.Activator]::CreateInstance("Namespace.Type") | |
$nameOfMethod = $specificType.GetMethod("NameOfMethod", [System.Reflection.BindingFlags]::NonPublic -bor [System.Reflection.BindingFlags]::Instance) | |
$nameOfMethod.Invoke($instanceTypeObj, @(Parameter1, Parameter2, Parameter3)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment