Aliasing


One easy way to extend a type is to alias existing properties or methods. For example, the NET Framework's System.Array type has a property named Length that tells you how many elements an array contains. However, to make this more consistent with other PowerShell syntax, PowerShell's designers wanted to be able to refer to this property by the name Count. So, they simply aliased the property in a type extension:

 <Type>  <Name>System.Array</Name>   <Members>    <AliasProperty>     <Name>Count</Name>     <ReferencedMemberName>Length</ReferencedMemberName>    </AliasProperty>    </Members> </Type> 

Here the original .NET type, System.Array, is called out. An AliasProperty section defines a new property, Count, which refers to the existing property, Length.



Windows PowerShell. TFM
Internet Forensics
ISBN: 982131445
EAN: 2147483647
Year: 2004
Pages: 289

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net