Go Back   RunUO - Ultima Online Emulation > Developer's Corner > Programming > C#

C# C# Discussion

Reply
 
Thread Tools Display Modes
Old 02-14-2007, 01:06 PM   #26 (permalink)
Forum Expert
 
mordero's Avatar
 
Join Date: Nov 2003
Location: Illinois, USA
Age: 22
Posts: 2,911
Default

its pulling different information about each drive you have in your computer...
mordero is offline   Reply With Quote
Old 02-14-2007, 01:07 PM   #27 (permalink)
ConnectUO Creator
 
Jeff's Avatar
 
Join Date: Jan 2004
Age: 28
Posts: 4,886
Default

Quote:
Originally Posted by Storm33229 View Post
tbchwy, I don't fully understand this. Can you explain a bit more about what that does?
It just gets info about each Hard drive on the computer nothing more nothing less, but you can use this info for things like grabbing handles on the harddrive to read the raw sectors and such
__________________
Jeff Boulanger
ConnectUO - Core Developer

Want to help make ConnectUO better? Click here to submit your ideas/requests
Use your talent to compete against other community members in RunUO hosted coding competitions

If you know XNA (even if its just a little) or are a good artist(2d or 3d) and are interested in making games for a hobby send me a pm or drop by #xna in irc.runuo.com. I'm looking to put together a small game development team.


Please do not pm me for support. If you are having issues please post in the appropriate forum. Thanks for your continued support of both ConnectUO and RunUO
Jeff is offline   Reply With Quote
Old 02-14-2007, 01:21 PM   #28 (permalink)
Forum Expert
 
Join Date: Jul 2003
Location: Arizona
Age: 18
Posts: 3,186
Send a message via AIM to Storm33229 Send a message via Yahoo to Storm33229
Default

Quote:
Originally Posted by Jeff View Post
It just gets info about each Hard drive on the computer nothing more nothing less, but you can use this info for things like grabbing handles on the harddrive to read the raw sectors and such
do you have to use both blocks of code? or just one or the other?
__________________
Quote:
Originally Posted by Radwen
You should crush your pills and sniff them.
Storm33229 is offline   Reply With Quote
Old 02-14-2007, 01:38 PM   #29 (permalink)
ConnectUO Creator
 
Jeff's Avatar
 
Join Date: Jan 2004
Age: 28
Posts: 4,886
Default

Quote:
Originally Posted by Storm33229 View Post
do you have to use both blocks of code? or just one or the other?
depends on what your doing, the 1st is kinda like a hashtable, and second is aquiring its values by using its keys :/
__________________
Jeff Boulanger
ConnectUO - Core Developer

Want to help make ConnectUO better? Click here to submit your ideas/requests
Use your talent to compete against other community members in RunUO hosted coding competitions

If you know XNA (even if its just a little) or are a good artist(2d or 3d) and are interested in making games for a hobby send me a pm or drop by #xna in irc.runuo.com. I'm looking to put together a small game development team.


Please do not pm me for support. If you are having issues please post in the appropriate forum. Thanks for your continued support of both ConnectUO and RunUO
Jeff is offline   Reply With Quote
Old 02-14-2007, 01:48 PM   #30 (permalink)
Forum Expert
 
Join Date: Jul 2003
Location: Arizona
Age: 18
Posts: 3,186
Send a message via AIM to Storm33229 Send a message via Yahoo to Storm33229
Default

Quote:
Originally Posted by Jeff View Post
depends on what your doing, the 1st is kinda like a hashtable, and second is aquiring its values by using its keys :/
so...confusing...*dies*
__________________
Quote:
Originally Posted by Radwen
You should crush your pills and sniff them.
Storm33229 is offline   Reply With Quote
Old 02-14-2007, 02:11 PM   #31 (permalink)
ConnectUO Creator
 
Jeff's Avatar
 
Join Date: Jan 2004
Age: 28
Posts: 4,886
Default

Quote:
Originally Posted by Storm33229 View Post
so...confusing...*dies*
about what?
__________________
Jeff Boulanger
ConnectUO - Core Developer

Want to help make ConnectUO better? Click here to submit your ideas/requests
Use your talent to compete against other community members in RunUO hosted coding competitions

If you know XNA (even if its just a little) or are a good artist(2d or 3d) and are interested in making games for a hobby send me a pm or drop by #xna in irc.runuo.com. I'm looking to put together a small game development team.


Please do not pm me for support. If you are having issues please post in the appropriate forum. Thanks for your continued support of both ConnectUO and RunUO
Jeff is offline   Reply With Quote
Old 02-14-2007, 11:11 PM   #32 (permalink)
Forum Expert
 
Join Date: Jul 2003
Location: Arizona
Age: 18
Posts: 3,186
Send a message via AIM to Storm33229 Send a message via Yahoo to Storm33229
Default

Quote:
Originally Posted by Jeff View Post
about what?
Uhh. Hashtables? =/
__________________
Quote:
Originally Posted by Radwen
You should crush your pills and sniff them.
Storm33229 is offline   Reply With Quote
Old 02-14-2007, 11:47 PM   #34 (permalink)
ConnectUO Creator
 
Jeff's Avatar
 
Join Date: Jan 2004
Age: 28
Posts: 4,886
Default

Quote:
Originally Posted by Storm33229 View Post
Uhh. Hashtables? =/
Dictionary<key, value> ? that better for you? same concept, but not type-casted.
__________________
Jeff Boulanger
ConnectUO - Core Developer

Want to help make ConnectUO better? Click here to submit your ideas/requests
Use your talent to compete against other community members in RunUO hosted coding competitions

If you know XNA (even if its just a little) or are a good artist(2d or 3d) and are interested in making games for a hobby send me a pm or drop by #xna in irc.runuo.com. I'm looking to put together a small game development team.


Please do not pm me for support. If you are having issues please post in the appropriate forum. Thanks for your continued support of both ConnectUO and RunUO
Jeff is offline   Reply With Quote
Old 02-15-2007, 10:32 AM   #35 (permalink)
Forum Expert
 
Join Date: Jul 2003
Location: Arizona
Age: 18
Posts: 3,186
Send a message via AIM to Storm33229 Send a message via Yahoo to Storm33229
Default

Quote:
Originally Posted by Jeff View Post
Dictionary<key, value> ? that better for you? same concept, but not type-casted.
What's casted mean? Grr.. my programming books don't tell me these things. =/
__________________
Quote:
Originally Posted by Radwen
You should crush your pills and sniff them.
Storm33229 is offline   Reply With Quote
Old 02-15-2007, 12:24 PM   #36 (permalink)
ConnectUO Creator
 
Jeff's Avatar
 
Join Date: Jan 2004
Age: 28
Posts: 4,886
Default

Quote:
Originally Posted by Storm33229 View Post
What's casted mean? Grr.. my programming books don't tell me these things. =/
lets say you have(for this example im gonna use runuo code cause i tihnk u will understand that better)

Code:
public void Method( Mobile m )
{
   if( m is PlayerMobile )//Check if m is of type PlayerMobile
   {
       PlayerMobile pm = (PlayerMobile)m;//Cast m as a PlayerMobile
       pm.MethodTwo();
   }
}
In that example I Casted Mobile m as a PlayerMobile.

Hashtable works the same as an arraylist in the sense that whenn you pull an object out of it, its only an object and needs to be cast as its real valuetype. Dictionary<type, type> solved this issue the same way List<type> solved it for an ArrayList.
__________________
Jeff Boulanger
ConnectUO - Core Developer

Want to help make ConnectUO better? Click here to submit your ideas/requests
Use your talent to compete against other community members in RunUO hosted coding competitions

If you know XNA (even if its just a little) or are a good artist(2d or 3d) and are interested in making games for a hobby send me a pm or drop by #xna in irc.runuo.com. I'm looking to put together a small game development team.


Please do not pm me for support. If you are having issues please post in the appropriate forum. Thanks for your continued support of both ConnectUO and RunUO
Jeff is offline   Reply With Quote
Old 02-15-2007, 02:31 PM   #37 (permalink)
Forum Expert
 
mordero's Avatar
 
Join Date: Nov 2003
Location: Illinois, USA
Age: 22
Posts: 2,911
Default

As a side note: when you put anything into a hashtable, its "boxes" it into an object (since everything is derived from an object). So you must "unbox" everything that comes out of a hashtable and cast it to its correct type. However, this could throw an exception if you cast it wrong, so a dictionary solves this problem because you no longer have to cast whatever you take out of it.
mordero is offline   Reply With Quote
Old 02-15-2007, 05:07 PM   #38 (permalink)
Forum Expert
 
Join Date: Jul 2005
Location: Istanbul/Turkey
Age: 27
Posts: 425
Default

boxing/unboxing is only true for value types.

and casting wrong was not the problem, it was efficiency. casting objects is a very high overhead.
__________________
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it."
noobie is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5