Advertise with us

Can I assign values from my collection in a string array..?? (c#)

Hi Everyone!

I am trying to get values from name value collection and trying to store it in a string array

for (int i=0; i<arr.Length; i++)
{
    arr[i] = DataRowColl.GetValue[i];
}
DataRow.Coll is my namevaluecollection. Its giving the error that reference without parentheses, Can I assign values from my collection in a string array..??

Thanks in advance! 

Last updated:5/3/2013 9:09:04 AM

1 Answers

AVADHESH PATEL
AVADHESH PATEL

Hi Jayden!


GetValue is not a member of NameValueCollection. The function is called Get. If you want to use the [] operator, you don't have do call the Get function. So call

arr[i] = DataRowColl[i];
or:

arr[i] = DataRowColl.Get(i);

Last updated:5/3/2013 9:09:04 AM

Answer