Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Intellisense / get-member

Reply
 
Old 01-25-2007   #1 (permalink)
Steve Schofield


 
 

Intellisense / get-member

I miss Visual Studio and intellisense at times. I don't miss the overhead
though. Is there a way to list a namespace methods, properties without
declaring the variable first?

I know the .NET framework pretty well but not memorized everything. Is
there a built-in cmdlet to display properties, methods of a particular
namespace by typing just a command.. Kind of like Object Browser in Visual
Studio.

'These two statements print out the methods and works fine.
$sw = new-object system.io.streamwriter("c:\temp\ss.txt")
$sw | get-member -membertype methods

Is there a way to do and print out methods?
get-member System.IO.Streamwriter -memberType methods

--

Steve Schofield
Windows Server MVP - IIS
ASPInsider Member - MCP

http://www.orcsweb.com/
Managed Complex Hosting
#1 in Service and Support



My System SpecsSystem Spec
Old 01-26-2007   #2 (permalink)
Jacques Barathon [MS]


 
 

Re: Intellisense / get-member

"Steve Schofield" <steve@deviq.com> wrote in message
news:ewAk9SQQHHA.1000@TK2MSFTNGP05.phx.gbl...
<...>
> I know the .NET framework pretty well but not memorized everything. Is
> there a built-in cmdlet to display properties, methods of a particular
> namespace by typing just a command.. Kind of like Object Browser in
> Visual Studio.
>
> 'These two statements print out the methods and works fine.
> $sw = new-object system.io.streamwriter("c:\temp\ss.txt")
> $sw | get-member -membertype methods
>
> Is there a way to do and print out methods?
> get-member System.IO.Streamwriter -memberType methods


It works well for static methods (note the parenthesis and square brackets
around the class name):

PS> get-member -in ([system.math]) -static

TypeName: System.Math

Name MemberType Definition
---- ---------- ----------
Abs Method static System.Single Abs(Single value), static
Syst...
Acos Method static System.Double Acos(Double d)
Asin Method static System.Double Asin(Double d)
Atan Method static System.Double Atan(Double d)
....

If you want to explore properties and methods available to class instances,
I think you have to create an instance first.

Jacques

My System SpecsSystem Spec
Old 01-29-2007   #3 (permalink)
Adam Milazzo


 
 

Re: Intellisense / get-member

Steve Schofield wrote:
> I miss Visual Studio and intellisense at times. I don't miss the overhead
> though. Is there a way to list a namespace methods, properties without
> declaring the variable first?
>
> I know the .NET framework pretty well but not memorized everything. Is
> there a built-in cmdlet to display properties, methods of a particular
> namespace by typing just a command.. Kind of like Object Browser in Visual
> Studio.
>
> 'These two statements print out the methods and works fine.
> $sw = new-object system.io.streamwriter("c:\temp\ss.txt")
> $sw | get-member -membertype methods
>
> Is there a way to do and print out methods?
> get-member System.IO.Streamwriter -memberType methods


You don't need to assign to a variable. You can pipe the new object into
the get-member call:

new-object text.stringBuilder | get-member -memberType methods

If you don't want to create an instance at all, you can use reflection:

[text.stringBuilder].getMethods() | % { $_.name } | sort -unique
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Add-Member not Adding a member PowerShell
Build My Own Intellisense .NET General
Configuration of Intellisense. .NET General
Visual Studio Intellisense PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46