Quantcast
Channel: Brainteaser – PowerShell Magazine
Viewing all articles
Browse latest Browse all 12

Enum’s numeric values

$
0
0

 

Advanced

Without any loop statements or pipelines, get the numeric values of an Enum (such as IO.FileAttributes) in 1 statement.

Click the icons below for answer and explanation.


 

<span style="color: #008080;">[Long[]]</span><span style="color: #008080;">[Enum]</span><span style="color: #a9a9a9;">::</span><span style="color: #000000;">GetValues</span><span style="color: #000000;">(</span><span style="color: #8b0000;">'IO.FileAttributes'</span><span style="color: #000000;">)</span>
<span style="color: #008080;">[Enum]</span><span style="color: #a9a9a9;">::</span><span style="color: #000000;">GetValues</span><span style="color: #000000;">(</span><span style="color: #8b0000;">'IO.FileAttributes'</span><span style="color: #000000;">)</span> <span style="color: #a9a9a9;">-as</span> <span style="color: #8b0000;">'Long[]'</span>


Winner: James Brundage


Viewing all articles
Browse latest Browse all 12

Trending Articles