Assigning values from list to list excluding nulls
Posted
by GutierrezDev
on Stack Overflow
See other posts from Stack Overflow
or by GutierrezDev
Published on 2010-03-17T20:13:44Z
Indexed on
2010/03/17
20:41 UTC
Read the original article
Hit count: 135
c#
Hi. Sorry for the title but I don't know other way of asking.
I got 2 Dictionary < string,string > list
One of them has a length of 606 items including null values. The other one has a length of 285 items. I determined the length doing this:
int count = 0;
for (int i = 0; i < temp.Length; i++)
{
if (temp[i] != null)
count++;
}
Now I want to assign every value in the temp variable to another variable excluding the null values.
Any Idea? Remember that I have a different size variables.
Edited
Dictionary<string, string>[] info;
Dictionary<string, string>[] temp = new Dictionary<string, string>[ds.Tables[0].Rows.Count];
.... Here I added some data to the Temp variable .....
Then this:
int count = 0
for (int i = 0; i < temp.Length; i++)
{
if (temp[i] != null)
count++;
}
info = new Dictionary<string, string>[count];
Hope you understand now.
© Stack Overflow or respective owner