lundi 15 juin 2015

How to disambiguate the Type.GetProperty method in Powershell?

I am trying to create a Powershell script that does what the C# code in this answer does.

When I get to the line

$type = ($fieldlink).GetType()
$propInfo = $type.GetProperty("Default", [System.Reflection.BindingFlags]::NonPublic -bor [System.Reflection.BindingFlags]::Instance)

I'm getting an error

Multiple ambiguous overloads found for "GetProperty" and the argument count: "2".

How do I disambiguate and specify that I want the overload that takes a string and BindingFlags?





Aucun commentaire:

Enregistrer un commentaire