Skip to content

Commit 4e96eab

Browse files
StartAutomatingStartAutomating
authored andcommitted
Adding 'new' keyword (#128)
1 parent 9fc0703 commit 4e96eab

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

docs/New.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
2+
New
3+
---
4+
### Synopsis
5+
'new' keyword
6+
7+
---
8+
### Description
9+
10+
This transpiler enables the use of the keyword 'new'.
11+
12+
new acts as it does in many other languages.
13+
14+
It creates an instance of an object.
15+
16+
'new' can be followed by a typename and any number of arguments or hashtables.
17+
18+
If 'new' is followed by a single string, and the type has a ::Parse method, new will parse the value.
19+
20+
If 'new'
21+
22+
---
23+
### Examples
24+
#### EXAMPLE 1
25+
```PowerShell
26+
{ new DateTime }
27+
```
28+
29+
#### EXAMPLE 2
30+
```PowerShell
31+
{ new byte 1 }
32+
```
33+
34+
#### EXAMPLE 3
35+
```PowerShell
36+
{ new int[] 5 }
37+
```
38+
39+
#### EXAMPLE 4
40+
```PowerShell
41+
{ new datetime 12/31/1999 }
42+
```
43+
44+
#### EXAMPLE 5
45+
```PowerShell
46+
{ new @{RandomNumber = Get-Random; A ='b'}}
47+
```
48+
49+
#### EXAMPLE 6
50+
```PowerShell
51+
{ new Diagnostics.ProcessStartInfo @{FileName='f'} }
52+
```
53+
54+
---
55+
### Parameters
56+
#### **CommandAst**
57+
58+
|Type |Requried|Postion|PipelineInput |
59+
|------------------|--------|-------|--------------|
60+
|```[CommandAst]```|true |1 |true (ByValue)|
61+
---
62+
### Syntax
63+
```PowerShell
64+
New [-CommandAst] <CommandAst> [<CommonParameters>]
65+
```
66+
---
67+
68+

0 commit comments

Comments
 (0)