G
Guest
Give the method ProcessArray as follows:
void ProcessArray(Object [] objects)
{
foreach (Object object in objects)
{
// Do something
}
}
I can call it as follows:
Object [] ojectArray = {object1, object2, object3};
ProcessArray(objectArray);
But I would like to know if I can call it on one line by declaring the
object array in the method invocation such as:
ProcessArray({object1, object2, object3});
The compiler just doesn't like that. Any ideas?
Thanks,
void ProcessArray(Object [] objects)
{
foreach (Object object in objects)
{
// Do something
}
}
I can call it as follows:
Object [] ojectArray = {object1, object2, object3};
ProcessArray(objectArray);
But I would like to know if I can call it on one line by declaring the
object array in the method invocation such as:
ProcessArray({object1, object2, object3});
The compiler just doesn't like that. Any ideas?
Thanks,