P
Pavils Jurjans
Hello,
I think this is classical problem, but I can't figure out how to do it in
most right way (I know ineffective way though
So, I have this method that does some database work and has to return an
array of custom type, let's say
public MyType[] MyMethod(params)
{
ArrayList output = new ArrayList();
}
Since the return array can be of different sizes, dependinf on parameters, I
use standard ArrayList within the body of MyMethod to gather the results.
Whenever a new element is added, something like this is executed:
MyType element = new MyType();
// Some element data populating code
output.Add(element);
Now, when I need to return the output, I need to do some kind of chemistry
so that it is returned as correct MyType[]. What is the most appropriate
way?
Thanks,
Pavils Jurjans
I think this is classical problem, but I can't figure out how to do it in
most right way (I know ineffective way though
So, I have this method that does some database work and has to return an
array of custom type, let's say
public MyType[] MyMethod(params)
{
ArrayList output = new ArrayList();
}
Since the return array can be of different sizes, dependinf on parameters, I
use standard ArrayList within the body of MyMethod to gather the results.
Whenever a new element is added, something like this is executed:
MyType element = new MyType();
// Some element data populating code
output.Add(element);
Now, when I need to return the output, I need to do some kind of chemistry
so that it is returned as correct MyType[]. What is the most appropriate
way?
Thanks,
Pavils Jurjans