Skip to content

Latest commit

 

History

History

Magic-method-Where

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Magic method Where

The magic method Where is similar to the cmdlet Where-Object but not exactly the same. The differences may lead to subtle mistakes, e.g. on carelessly changing some code from using one to another.

The magic method Where returns a collection of zero, one, or more items. The result type is always [System.Collections.ObjectModel.Collection`1[PSObject]].

In same cases, i.e. with same input and script blocks, the cmdlet Where-Object returns either nothing (kind of null) or one item (the type depends on it) or an array of items. The result type is none, some, or System.Object[].

Scripts