Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 18th, 2005, 05:17 PM
Authorized User
 
Join Date: Jul 2003
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default Complex Data Structures

I have been programming perl for a few years, and am used to being able to build and access complex data structures like hashes of hashes, arrays of hashes, hashes of arrays, etc.

I am trying to do the same in VB.NET, and eventually in C#, but I am finding very little on how to do this. Building these structures seems to be easy. For example
Code:
myHash.Add("key", myArray) 'myArray is an arraylist of strings
to make a hashtable entry that is an array.

I just can't seem to figure out how to get at the array once it is in the hash. Any direction/documentation would be greatly appreciated.

Thanks.
 
Old March 18th, 2005, 08:33 PM
Authorized User
 
Join Date: Jul 2003
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Never mind,

I was able to use the debugger to see how the array is being stored, and then use that info to figure out how to reference it.
 
Old March 19th, 2005, 04:40 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
quote:I just can't seem to figure out how to get at the array once it is in the hash
you give the key and hashtable gives the entry(according to the GetHashCode which is implemented in the keys,in your case String.GetHashCode)
Code:
//C#
ArrayList ar=(ArrayList)myHash["key"];
_____________
Mehdi.
software student.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Topics needed in Data Structures c.vikramnarayan C++ Programming 1 June 19th, 2009 09:56 PM
data structures problems detence C++ Programming 1 April 11th, 2007 11:27 AM
Algorithms Data Structures p0120144 C++ Programming 3 March 25th, 2006 08:34 AM
data structures silvia C# 4 January 19th, 2006 04:25 AM
data structures in C# Xanoo C# 4 July 1st, 2004 03:44 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.