![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | custom types for System.Int32 I am trying to add a custom ScriptMethod to System.Int32 I have the following XML file that I load with Update-TypeData <Types> <Type> <Name>System.Int32</Name> <Members> <ScriptMethod> <Name>Test</Name> <Script> write-host $this </Script> </ScriptMethod> </Members> </Type> </Types> If I run the command $int = 5 $int.test() I get my result as expected. It writes itself ($this) to the console.\ However, if I try to run the method directly on the number 6 I get a bad constant error PS 8 > 6.test() Bad numeric constant: 6.times. At line:1 char:7 + 6.times <<<< () If I pipe 6 to get-member i see my custom member is there Any ideas ? Thanks, Andy |
My System Specs![]() |
| | #2 (permalink) | ||||||||||||
| Guest | Re: custom types for System.Int32 "ASCHNEIDER146" <aschneider146@xxxxxx> wrote in message news:1190664707.833567.174800@xxxxxx
266# 6.tostring() Bad numeric constant: 6.tostring. At line:1 char:10 + 6.tostring <<<< () Try it this way: 267# (6).tostring() 6 -- Keith | ||||||||||||
My System Specs![]() | |||||||||||||
| | #3 (permalink) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Guest | Re: custom types for System.Int32 On Sep 24, 1:56 pm, "Keith Hill [MVP]" <r_keith_h...@xxxxxx_no_spam_I> wrote:
Andy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
My System Specs![]() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| types.custom.ps1xml for custom members | hasten | PowerShell | 0 | 02-25-2008 08:30 PM |
| Error: "Cannot convert "System.Object[]" to "System.Int32"." | Shay Levi | PowerShell | 3 | 01-31-2008 04:16 AM |
| Unable to associate file types to custom application | Steinar Haugen | Vista file management | 2 | 04-18-2007 05:25 AM |
| Using add-member with System.Int32 | Marco Shaw | PowerShell | 2 | 03-02-2007 04:29 PM |