|
-
Sep 22nd, 2006, 06:57 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] [2005] deleting array elements - quick question!
I have an array and was wondering whether it was possible to go through the array and delete all the elements that are equal to NULL? If not the would it be possible to do it if i used a List(of T) instead of an array?
-
Sep 22nd, 2006, 07:49 AM
#2
Re: [2005] deleting array elements - quick question!
You can't delete items from the Array, once you initialize the array you can't change the size except with the "Redim" operator which will delete all values not just the null ones
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Sep 22nd, 2006, 07:51 AM
#3
Thread Starter
Fanatic Member
Re: [2005] deleting array elements - quick question!
So would you suggest using a list(of T) instead then? Or is there some other way to achieve what i want?
-
Sep 22nd, 2006, 08:49 AM
#4
Re: [2005] deleting array elements - quick question!
List(Of T) is a good method, but it all depends on what do you want to do!!
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Sep 22nd, 2006, 09:10 AM
#5
Thread Starter
Fanatic Member
Re: [2005] deleting array elements - quick question!
I have a thread that is controlled by a timer. This thread downloads an XML file everytime the timer ticks and stores the information from the XML file into an array. Now when the timer ticks and another XML file is downloaded then the elements in the array were being replaced so i created another array to copy all the elements of the first array and then jus kept copying across everytime the timer ticked. But it kept copying all the elements of the first array that had nothing in them so i would get an array which had the following element entries:
arrayElement(0) = nothing
arrayElement(1) = something
arrayElement(2) = nothing
arrayElement(3) = something
arrayElement(4) = nothing
etc.....
so i needed another way to store it so that i didn't keep getting elements with nothing in them.
Would this still happen if i use list(of T)?
-
Sep 22nd, 2006, 10:06 AM
#6
Re: [2005] deleting array elements - quick question!
If you use lists, you can add and remove items easily
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|