mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Allow the PSGetMemberBinder to get value of ByRef property (#16956)
This commit is contained in:
@@ -108,3 +108,21 @@ Describe "Interface static members" -Tags "CI" {
|
||||
$obj.GetId() | Should -Be 100
|
||||
}
|
||||
}
|
||||
|
||||
Describe "ByRef property" -Tags "CI" {
|
||||
|
||||
It "Get value from ByRef property" {
|
||||
$list = [System.Collections.Generic.LinkedList[int]]::new()
|
||||
$node = $list.AddLast(1)
|
||||
|
||||
## Get value through language binder.
|
||||
$node.ValueRef | Should -Be 1
|
||||
|
||||
## Get value through .NET adapter.
|
||||
$property = $node.PSObject.Properties["ValueRef"]
|
||||
$property.IsSettable | Should -BeFalse
|
||||
$property.IsGettable | Should -BeTrue
|
||||
$property.TypeNameOfValue | Should -BeExactly 'System.Int32&'
|
||||
$property.Value | Should -Be 1
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user