Re: (msh) [net.IPAddress]::tryparse()

Tech-Archive recommends: Fix windows errors by optimizing your registry



I can't help you out. But I think the problem resides in some pointer
issue:

<output>
MSH C:\WINDOWS\system32> $ip | get-member -static


TypeName: System.Net.IPAddress

Name MemberType Definition
---- ---------- ----------
Equals Method static System.Boolean Equals(Object objA,
Object objB)
HostToNetworkOrder Method static System.Int64
HostToNetworkOrder(Int64 host), static System.Int32 Host
IsLoopback Method static System.Boolean
IsLoopback(IPAddress address)
NetworkToHostOrder Method static System.Int64
NetworkToHostOrder(Int64 network), static System.Int32 N
Parse Method static System.Net.IPAddress Parse(String
ipString)
ReferenceEquals Method static System.Boolean
ReferenceEquals(Object objA, Object objB)
TryParse Method static System.Boolean TryParse(String
ipString, IPAddress& address)
Any Property static System.Net.IPAddress Any
{get;set;}
Broadcast Property static System.Net.IPAddress Broadcast
{get;set;}
IPv6Any Property static System.Net.IPAddress IPv6Any
{get;set;}
IPv6Loopback Property static System.Net.IPAddress IPv6Loopback
{get;set;}
IPv6None Property static System.Net.IPAddress IPv6None
{get;set;}
Loopback Property static System.Net.IPAddress Loopback
{get;set;}
None Property static System.Net.IPAddress None
{get;set;}

</output>

Tryparse() is a method expecting an output parameter. Means it want's
pointer if I am not completely wrong. Regrettably the syntax implied by
the output of get-member does not work:

<output2>

MSH C:\WINDOWS\system32> [net.ipaddress]::tryparse($ip2,
system.net.ipaddress& $ip)
Missing expression after ','.
At line:1 char:32
+ [net.ipaddress]::tryparse($ip2, <<<< system.net.ipaddress& $ip)
MSH C:\WINDOWS\system32> $ip = net.ipaddress& $ip
Ampersand not allowed. The & operator is reserved for future use; use
"&" to pass ampersand as a string.
At line:1 char:21
+ $ip = net.ipaddress& <<<< $ip
MSH C:\WINDOWS\system32>

</output2>

Maybe the Monad book states something about output parameters? My copy
did not arrive yet.

--
Artus

.



Relevant Pages

  • Re: How to prevent other PC from scaning my machine?
    ... [compton ~]$ host 64.12.14.81 ... 81.14.12.64.IN-ADDR.ARPA domain name pointer mtc-cache001.edns.aol.com ... windoze, and it's trying to find who it can "share" your information with. ...
    (alt.computer.security)
  • Re: Plz explain me the following code
    ... Unix says it should SEGV. ... follow the restrictions placed on you by the host platform". ... pointer not from mallocand friends. ... valid pointer but just not pointing to what is expected?) ...
    (comp.lang.c)
  • Re: Plz explain me the following code
    ... behave in a manner consistent with the host"? ... dereferencing a NULL pointer on Unix can't launch nuclear missiles, ... follow the restrictions placed on you by the host platform". ...
    (comp.lang.c)
  • Re: Plz explain me the following code
    ... Unix says it should SEGV. ... follow the restrictions placed on you by the host platform". ... For example, fcloseon an invalid FILE*, or freewith a pointer not from mallocand friends. ... (Yes, the host may get involved if the pointer itself is not valid, but what happens with a valid pointer but just not pointing to what is expected?) ...
    (comp.lang.c)
  • Re: Duplicate DNS Records
    ... Scavenging works hand-in-hand with your lease duration. ... > janedoe Host 10.1.7.11 ... > 10.1.7.1 Pointer (PTR) mediacenter. ...
    (microsoft.public.win2000.dns)