Search notes:

Powershell: Param(valueFromPipelineByPropertyName)

function F {

   param (
      [parameter(valueFromPipelineByPropertyName)] $foo,
      [parameter(valueFromPipelineByPropertyName)] $bar,
      [parameter(valueFromPipelineByPropertyName)] $baz
   )

   process {
      write-host

      if ($foo) { write-host "foo = $foo" }
      if ($bar) { write-host "bar = $bar" }
      if ($baz) { write-host "baz = $baz" }
   }
}


class clsX {
   [int] $bar = 42
}


class clsY {
   [string] $baz = 'hello world'
}


class clsZ {
   [int   ] $bar =  99
   [string] $foo = 'ninety-nine'
}


$objX = new-object clsX
$objY = new-object clsY
$objZ = new-object clsZ


$objX, $objY, $objZ | F
Github repository about-PowerShell, path: /language/statement/function/parameters/attributes/parameter/valueFromPipelineByPropertyName/simple.ps1

See also

Function and script parameter attributes

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/Windows/...', 1758193861, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Windows/PowerShell/language/statement/function/parameters/attributes/parameter/valueFromPipelineByPropertyName/index(77): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78