Last active
June 10, 2016 15:32
-
-
Save adamdriscoll/3e5ac204196a106329a09076965ad31a to your computer and use it in GitHub Desktop.
Properties are just methods
This file contains 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
#Backing methods | |
[System.Collections.ArrayList].GetMethods() | Where Name -like 'get_*' | Select Name | |
[System.Collections.ArrayList].GetMethods() | Where Name -like 'set_*' | Select Name | |
$ArrayList = New-Object System.Collections.ArrayList | |
$ArrayList.Add(1) | Out-Null | |
$ArrayList.Add(2) | Out-Null | |
#Indexer (parameterized property) | |
$ArrayList[1] | |
#Underlying method | |
$ArrayList.get_Item(1) | |
#Underlying method | |
$ArrayList.set_Item(1, 10) | |
#Indexer (parameterized property) | |
$ArrayList[1] | |
#Property | |
$ArrayList.Count | |
#Underlying method | |
$ArrayList.get_Count() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment