I need to keep inside a PSCustomObject, values at 2 or 3 places and these places are different depending of the object created. The object are hard coded in the script but sometime I need to change the values. But instead of change theses value at 2 or 3 places, is it possible to self refer item instead of edit all the place where the values are?
Here is an example that could explain what I'm trying to do:
$objInfo = [PSCustomObject]@{
name = 'TheObjectName'
color = 'red'
size = 'small'
mystring = "The $($self.name) is $($self.color) and $($self.size)"
}
Is it possible to refer to itself with something like $self?