I have a 'SourceClass' class with the simple C# method:
public bool TryGetSection<T>(out T result) where T : class, new()
{ //do something and return true/false }
and I'd like to execute it from powershell code.
$_config = New-Object [SourceClass]
$method = [SourceClass].GetMethod("TryGetSection")
$genericMethod = $method.MakeGenericMethod([AuthenticationProviderTypeConfig])
$authenticationProviderTypeConfig = New-Object AuthenticationProviderTypeConfig
$genericMethod.Invoke($_config, $authenticationProviderTypeConfig)
$authenticationProviderType = $authenticationProviderTypeConfig.Type
After execution, I'm expecting that the $authenticationProviderType will be filled, but it isn't. I'm just getting an empty string. I suppose I miss something. Is it possible to call generic method that has 'out' parameter? Thanks.