Skip to content

Commit 6715edb

Browse files
committed
main
1 parent 20d18df commit 6715edb

File tree

7 files changed

+55
-7
lines changed

7 files changed

+55
-7
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Array
2+
3+
## Creation
4+
5+
> [!NOTE]
6+
> The default type of a array literal is `object[]`, you can annotate with a type.
7+
> ```ps1
8+
> [int[]]$foo = 1, 2, 3
9+
> ```
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# ETS Property
2+
3+
Extended Type System in Powershell has 4 kinds of property:
4+
5+
- Alias Property: An simple alias for another property.
6+
- Script Property: Getter/Setter for a custom property that can access other members, represented as a script block.
7+
- Note Property: An extra independent property added to the object.
8+
9+
## Alias Property
10+
11+
- Inspect Alias Property by:
12+
13+
```ps1
14+
gps | gm -MemberType AliasProperty
15+
```
16+
17+
- Add Alias Property by:
18+
19+
```ps1
20+
21+
```

docs/document/Powershell/docs/Object Manipulation/Extended Type System.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,14 @@ The functionality of ETS achieved benifits:
2626

2727
## ETS Members
2828

29+
To represent meta of ETS members, Powershell has an abstract class called `PSMemberInfo`, each concrete member info type is derived from it.
2930

31+
```cs
32+
public abstract class PSMemberInfo { }
33+
```
34+
35+
36+
The facts of ETS members:
37+
- each member has a type inherited from `PSMemberInfo`.
38+
39+
## PSObject

docs/document/Powershell/docs/Object Manipulation/ForEach.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@ If you do want a `$null` return, use `Out-Null` to swallow the value.
2828
(gci | foreach { $_.Name | Out-Null }) -eq $null # True
2929
```
3030

31+
32+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Object Creation
2+
3+
- Create a `.NET` type instance.
4+
- Create a `PSObject`.
5+
- Create a `PSCustomObject`

docs/document/Powershell/docs/Object Manipulation/Select.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ gps | select -ExpandProperty Name
7979

8080
> [!NOTE]
8181
> `Foreach-Object` can achieve the same thing
82-
```ps1
83-
gps | foreach Name
84-
# or use another alias of Foreach-Object %
85-
gps | % Name
86-
```
82+
> ```ps1
83+
> gps | foreach Name
84+
> # or use another alias of Foreach-Object %
85+
> gps | % Name
86+
> ```
8787
8888
### Append Extra NoteProperty
8989
@@ -105,8 +105,6 @@ $john = @{
105105
$john | select Name, Age -ExpandProperty Pet
106106
```
107107
108-
109-
110108
> [!NOTE]
111109
> `-ExpandProperty` can only take one property.
112110
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Sort
2+
3+

0 commit comments

Comments
 (0)