@@ -11,7 +11,7 @@ title: about_Calling_Generic_Methods
1111Generics let you tailor a method, class, structure, or interface to the precise
1212data type it acts upon. For example, instead of using the
1313[ System.Collections.Hashtable] [ 01 ] class, which allows keys and values to be
14- of any type, you can use the [ System.Collections.Generic.Dictionary%602 ] [ 02 ]
14+ of any type, you can use the [ System.Collections.Generic.Dictionary] [ 02 ]
1515generic class and specify the types allowed for the ** key** and ** value**
1616properties. Generics provide increased code reusability and type safety.
1717
@@ -22,8 +22,8 @@ overloads, or when the generic method takes no formal parameter. PowerShell can
2222fail to resolve the correct method without the explicit generic method
2323arguments.
2424
25- For example, ` [array]::Empty<T> () ` . The .NET ** Array** class has a static,
26- generic method ` Empty<T> () ` that takes no formal parameters.
25+ For example, ` [array]::Empty[T] () ` . The .NET ** Array** class has a static,
26+ generic method ` Empty[T] () ` that takes no formal parameters.
2727
2828Prior to PowerShell 7.3, to ensure proper method resolution you had to use
2929complicated workarounds using .NET reflection. For an example, see Lee Holmes'
@@ -61,10 +61,10 @@ In this example, we create a list of integers then use the
6161` System.Linq.Enumerable ` class to enumerate the values and transform them to a
6262new value.
6363
64- The variable ` $list ` is a generic ` List<T> ` object that can only contain
65- integers. ` List<T> ` is a generic class that allows you to specify the type of
64+ The variable ` $list ` is a generic ` List[T] ` object that can only contain
65+ integers. ` List[T] ` is a generic class that allows you to specify the type of
6666its members when you create it.
67- ` [System.Linq.Enumerable]::Select< T1,T2> (T1,T2) ` is a generic method that
67+ ` [System.Linq.Enumerable]::Select[ T1,T2] (T1,T2) ` is a generic method that
6868require two generic type parameters and two formal value parameters.
6969
7070``` powershell
0 commit comments