|
It lokos like you got hit by a Drive-By Univoter...
|
|
|
|
|
Yes it would seem so.. he didn't drive around the rest of the forum too much though lol
|
|
|
|
|
When you call GetAllNetworkInterfaces , each instance of the NetworkInterface object you get back has a GetIpProperties method. Call that method on each interface and you'll get an IpInterfaceProperties object with all the IP address details in it for that adapter.
modified on Thursday, July 9, 2009 4:29 PM
|
|
|
|
|
That would be better than my less-than-reliable approach.
|
|
|
|
|
Hi Harold,
I'm not the one that onevoted you, however since I liked your latest message much more than the previous one, here is a 5.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
I'm writing a Windows Mobile 6 application in C#.NET. how can i search for wifi connections nearby and get ip
This code was posted by me...
|
|
|
|
|
|
1 want to list all wi-fi network connections using C#.
This code was posted by me...
|
|
|
|
|
Try a google search.[^]
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
I love it, I thought I'll take a look at the results for this one. 1st link is to CP, straight back to this message
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Yeah,it's intersing result search
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
Blue_Boy wrote: intersing result search
Latest page update phenomenon is the reason that is causing Google to bring this page on top.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep!
|
|
|
|
|
Hallo Board,
I am facing a problem with a self-written Equal Operator on a list<> class with own classes inside the list.
I want to compare lists thus I redefined the == Operator:
public override bool Equals(object obj)<br />
{<br />
UserList compUserList = (UserList)obj;<br />
foreach (PersonDataSet user in compUserList.list)<br />
{<br />
....
return true;<br />
}<br />
return false;<br />
}<br />
The problem is now that I checked in my code before writing the own operator if a special UserList has already been created by
if (testUserList != null) .
Now I get a NullPointer exception wenn testing for 'null'.
This is understandable, but does anyone have an idea how to solve the problem? Maybe a different check to test if an object has been created? Or is a check like this not good at all?
Thanks for your replies!
Regards
Chris
modified on Monday, July 13, 2009 5:32 AM
|
|
|
|
|
The operator == is not the same as the Equals method. Even the result can sometimes differ (as is the case with NaN's in float comparisons)
If you want to overload the == operator you would have to overload it.
|
|
|
|
|
I thought these operators were the same?
but I declared
public static bool operator ==(UserList userlist1, UserList userlist2)
{
return (userlist1.Equals(userlist2));
}
as well.
So these operators should be correctly defined.
Or am I wrong?
|
|
|
|
|
That should work, although you may be a good idea to test userlist1 for being null before calling Equals on it to avoid a nullref when testing null == userlist2
oh and you'd have to define != as well but the compiler will tell you that
|
|
|
|
|
chrisx51 wrote: testUserList
Does object testUserList exists? Where did you declare it?
Inside your function I can't see any object named testUserList.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
testUserList is being declared in the full programm when a new userlist is being created in another function.
But in the code I need to check a UserList has already been created thus i use if (testUserList != null to check if it really exists.
But my redefined function doesnt like a 'null' as parameter...
|
|
|
|
|
From past experience, overloading == and != on a class is generally not a good idea because of the possiblity of it being null.
It works great for structs, but that can bring other problems!
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Do you have a better idea to check the equality of an own List<>?
Shall I create a completely new function like ownEqualityCheck(UserList userlist...); ?
|
|
|
|
|
I've just had another look at this. It seems that by converting your class instances to objects, you can do a null check. e.g.
public class Test
{
private int internalValue;
public Test(int value)
{
internalValue = value;
}
public static bool operator ==(Test test1, Test test2)
{
object o1 = test1;
object o2 = test2;
if (o1 == null || o2 == null)
return (o1 == null && o2 == null);
return test1.internalValue == test2.internalValue;
}
public static bool operator !=(Test test1, Test test2)
{
return !(test1 == test2);
}
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Hi,
thank you very much for your hint!
I implemented it and it just works fine!
Regards,
Chris
|
|
|
|
|
Thsi may be silliy, but your operator overload code doesn't do any checking to see if one of the object passed in is null or not before trying to use it. You should be check to see if you actually have an object, handle the case where the object is null , then check to see if it is a valid object type to compare against, ...
|
|
|
|
|
So your advice is to use overloading the == Operator but with additional checks like:
public static bool operator ==(UserList userlist1, UserList userlist2)
{
if (userlist1 == null) return false;
....
}
But by doing so i repeatedly call the ==-Operator recursivly. Is this ok? I believe i get the NullPointerExcception as well.
--> ok I tested it and I get a StackOverflowException. Thats sort of what I Expected.
modified on Friday, July 10, 2009 5:53 AM
|
|
|
|
|
How can I load an XML Document to an ObservableCollection class that preserves the XML tree structure?
My xml looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<string xmlns="http://none.none.none/webservices">
<TREENODES xmlns:sql="urn:schemas-microsoft-com:xml-sql">
<TREENODE code="1" text="None" >
<TREENODE code="2" text="America" >
<TREENODE code="16128" text="AUTOS">
<TREENODE code="ATO" text="ATO" />
<TREENODE code="ATO" text="ATO" />
</TREENODE>
</TREENODE>
</TREENODE>
<TREENODE code="11" text="None" >
<TREENODE code="21" text="America" >
<TREENODE code="3" text="AUTOS">
<TREENODE code="ATO44" text="ATO5" />
</TREENODE>
</TREENODE>
</TREENODE>
</TREENODES>
</string>
|
|
|
|