Click here to Skip to main content
15,890,717 members
Home / Discussions / C#
   

C#

 
GeneralRe: dataGrid - change background color of cell on RUN TIME Pin
dataminers5-Nov-05 13:03
dataminers5-Nov-05 13:03 
GeneralRe: dataGrid - change background color of cell on RUN TIME Pin
Heath Stewart5-Nov-05 13:42
protectorHeath Stewart5-Nov-05 13:42 
QuestionLDAP User management Pin
WillemM5-Nov-05 9:18
WillemM5-Nov-05 9:18 
QuestionC# and .NET Framework Pin
Yevgeny Efter5-Nov-05 9:11
Yevgeny Efter5-Nov-05 9:11 
AnswerRe: C# and .NET Framework Pin
André Ziegler5-Nov-05 9:13
André Ziegler5-Nov-05 9:13 
AnswerRe: C# and .NET Framework Pin
Heath Stewart5-Nov-05 12:36
protectorHeath Stewart5-Nov-05 12:36 
Questionmaking the mouse perform a Drag-Drop with api Pin
jtmtv185-Nov-05 8:25
jtmtv185-Nov-05 8:25 
QuestionSingle Method With Mutiple Paremeters Pin
budidharma5-Nov-05 7:53
budidharma5-Nov-05 7:53 
I know I can overload the same function to take specific parememters, but I'm looking for something a little more than that.

I want to return an array of ints, based on the number of ints passed into the function (really, I'm using this with objects).

public static int[] BuildArray( /* ACCEPT A MULTIPLE NUMBER OF INTS, WITHOUT BEING IN AN ARRAY ALREADY /* )
{
int[] ints = new ints[ /*NUMBER OF INTS PASSED INTO THE FUNCTION /* ];
int i = 0;
foreach( /* INT PASSED INTO THE FUNCTION */ )
ints[i] = /* EACH INT PASSED IN */;
i++;
}

return ints;
}

... The method accepts a multiple number of paremeters, all int. I want it to build an array of them, then pass that back out.

Is this possible? Like I said, I know I can overload the function a whole bunch of times like so:
public static int[] BuildArray(int i1, int i2)
{
// BUILD ARRAY AND RETURN IT
}

public static int[] BuildArray(int i1, i2, i3)
{
// BUILD ARRAY AND RETURN IT
}

public static int[] BuildArray(int i1, i2, i3, i4)
{
// BUILD ARRAY AND RETURN IT
}

... but that's not elegant, and I'll have to write a method for every freaking number of ints that could be passed in. Ugh.

Any solution here?
Thanks!
AnswerRe: Single Method With Mutiple Paremeters Pin
[Marc]5-Nov-05 8:02
[Marc]5-Nov-05 8:02 
GeneralRe: Single Method With Mutiple Paremeters Pin
budidharma5-Nov-05 8:39
budidharma5-Nov-05 8:39 
GeneralRe: Single Method With Mutiple Paremeters Pin
J4amieC5-Nov-05 10:12
J4amieC5-Nov-05 10:12 
GeneralRe: Single Method With Mutiple Paremeters Pin
leppie5-Nov-05 18:57
leppie5-Nov-05 18:57 
GeneralRe: Single Method With Mutiple Paremeters Pin
J4amieC6-Nov-05 0:25
J4amieC6-Nov-05 0:25 
AnswerRe: Single Method With Mutiple Paremeters Pin
Heath Stewart6-Nov-05 6:01
protectorHeath Stewart6-Nov-05 6:01 
QuestionSystem Tray Icon Update Pin
Coffmans5-Nov-05 6:36
Coffmans5-Nov-05 6:36 
AnswerRe: System Tray Icon Update Pin
Heath Stewart5-Nov-05 12:33
protectorHeath Stewart5-Nov-05 12:33 
GeneralRe: System Tray Icon Update Pin
Coffmans5-Nov-05 13:33
Coffmans5-Nov-05 13:33 
GeneralRe: System Tray Icon Update Pin
Heath Stewart5-Nov-05 13:36
protectorHeath Stewart5-Nov-05 13:36 
QuestionProblems printing Pin
naglbitur5-Nov-05 6:15
naglbitur5-Nov-05 6:15 
AnswerRe: Problems printing Pin
Heath Stewart5-Nov-05 12:00
protectorHeath Stewart5-Nov-05 12:00 
GeneralRe: Problems printing Pin
naglbitur5-Nov-05 21:54
naglbitur5-Nov-05 21:54 
GeneralRe: Problems printing Pin
Heath Stewart6-Nov-05 5:55
protectorHeath Stewart6-Nov-05 5:55 
GeneralRe: Problems printing Pin
naglbitur31-Dec-05 8:02
naglbitur31-Dec-05 8:02 
AnswerRe: Problems printing Pin
Heath Stewart1-Jan-06 10:06
protectorHeath Stewart1-Jan-06 10:06 
GeneralRe: Problems printing Pin
naglbitur1-Jan-06 19:57
naglbitur1-Jan-06 19:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.