views:

37

answers:

1

Thanks to this article, I was able to come up with a script which sorts and displays the keywords PowerShell provides:

$bindingFlags = 
    [System.Reflection.BindingFlags]::NonPublic -bor 
    [System.Reflection.BindingFlags]::Static -bor 
    [System.Reflection.BindingFlags]::GetField

$keywordTokenReader = [System.Type]::GetType("System.Management.Automation.KeywordTokenReader")
$keywords = $keywordTokenReader.InvokeMember("_keywordTokens", $bindingFlags, $null, $null, $null)
$keywords.GetEnumerator() | Sort-Object -Property Name

I was looking at the list and I understand that class, define, using and var are reserved keywords, but just out of curiosity, does anybody have an example using the from and data keywords? I can't seem to find anything.

Thanks

EDIT

Use of the from keyword results in this:

PS H:\> from
The 'from' keyword is not supported in this version of the language.
At line:1 char:1

The help topic about_language_keywords is also useful.

+2  A: 

The help topic about_Data_Sections explains the data keyword, run:

help about_Data_Sections

As for the from keyword, I think it is just reserved and not yet used.

Roman Kuzmin
Ah, never saw that help section. Thanks.
George Howarth