object[] initialization as a parameter
-
Hi, I have a data source that has the the following method. .Rows.Add(object[] obj} How do I pass directly to it an array of parameters within parenthesis? Like the following ...Rows.Add(1, "Hello", "World", 18); or ...Rows.Add("1", "Hello", "World", "18"); or ...Rows.Add({"1", "Hello", "World", "18"}); I get errors like ...Rows.Add() does not take n parameters where n is equal to the number of values I put in. The last one gives me errors about the {} being all wrong. If I create the following: object[] obj = {1, "Hello", "World", 18}; ...Rows.Add(obj); Everything works fine. Cheers, Clint
-
Hi, I have a data source that has the the following method. .Rows.Add(object[] obj} How do I pass directly to it an array of parameters within parenthesis? Like the following ...Rows.Add(1, "Hello", "World", 18); or ...Rows.Add("1", "Hello", "World", "18"); or ...Rows.Add({"1", "Hello", "World", "18"}); I get errors like ...Rows.Add() does not take n parameters where n is equal to the number of values I put in. The last one gives me errors about the {} being all wrong. If I create the following: object[] obj = {1, "Hello", "World", 18}; ...Rows.Add(obj); Everything works fine. Cheers, Clint
Clint, Try this
Rows.Add( new object[] { 1, "Hello", "World", 18 } )
. Andy Human beings were not meant to sit in little cubicles staring at computer screens all day, filling out useless forms and listening to eight different bosses drone on about about mission statements. -- Peter Gibbons -
Clint, Try this
Rows.Add( new object[] { 1, "Hello", "World", 18 } )
. Andy Human beings were not meant to sit in little cubicles staring at computer screens all day, filling out useless forms and listening to eight different bosses drone on about about mission statements. -- Peter GibbonsThanks! That did the trick. Cheers, Clint