Click here to Skip to main content
15,907,001 members
Home / Discussions / C#
   

C#

 
QuestionApplication.Run() [modified] Pin
Chaitanya Joshi13-Oct-07 9:17
Chaitanya Joshi13-Oct-07 9:17 
AnswerRe: Application.Run() Pin
Kristian Sixhøj13-Oct-07 9:58
Kristian Sixhøj13-Oct-07 9:58 
AnswerRe: Application.Run() Pin
Luc Pattyn13-Oct-07 10:06
sitebuilderLuc Pattyn13-Oct-07 10:06 
AnswerRe: Application.Run() Pin
Christian Graus13-Oct-07 10:31
protectorChristian Graus13-Oct-07 10:31 
GeneralRe: Application.Run() Pin
Chaitanya Joshi13-Oct-07 21:28
Chaitanya Joshi13-Oct-07 21:28 
QuestionGet DNS Domains Entrys .. Pin
Davids Maguire13-Oct-07 7:46
Davids Maguire13-Oct-07 7:46 
AnswerRe: Get DNS Domains Entrys .. Pin
TJoe15-Oct-07 5:49
TJoe15-Oct-07 5:49 
QuestionSyntax for passing methods without declaring a delegate Pin
Domenic Denicola13-Oct-07 7:19
Domenic Denicola13-Oct-07 7:19 
I'm going to break out my question into a smaller sub-question this time, instead of trying to fit two questions into one post.

I basically have a method Control.PerformOngoingOperation that can call other methods, with string IDs assigned to each calling. Its signature is, currently:

object PerformOngoingOperation(Delegate method, out string id, params object[] args)

However, as far as I can tell, the user then has to declare a delegate every time:
class C
{
    delegate int annoying(int param1, bool param2, string param3);
    void Method()
    {
        string id;
        int retVal = (int)Control.PerformOngoingOperation(new annoying(Library.Object.Method), out id, 5, true, "test");
    }
}


I suppose an alternative is requiring that the delegate be of type MethodInvoker (basically void return type, no parameters), as such:

string PerformOngoingOperation(MethodInvoker method)

and forcing the user to do this:

int retVal;
string id = Control.PerformOngoingOperation((MethodInvoker)(new delegate() { retVal = Library.Object.Method(5, true, "test"); }));


But that's awkward at best.

Ideally I would like to have something like this instead:

string id;
int retVal = Control.PerformOngoingOperation(Library.Object.Method, out id, 5, true, "test");


Is that possible? If so, what's the syntax?


-Domenic Denicola- [CPUA 0x1337]

“I was born human. But this was an accident of fate—a condition merely of time and place. I believe it's something we have the power to change…”

AnswerRe: Syntax for passing methods without declaring a delegate Pin
Judah Gabriel Himango13-Oct-07 20:08
sponsorJudah Gabriel Himango13-Oct-07 20:08 
GeneralRe: Syntax for passing methods without declaring a delegate Pin
Domenic Denicola13-Oct-07 20:46
Domenic Denicola13-Oct-07 20:46 
GeneralRe: Syntax for passing methods without declaring a delegate Pin
Judah Gabriel Himango14-Oct-07 8:57
sponsorJudah Gabriel Himango14-Oct-07 8:57 
QuestionProblem Reading Excel File ? Pin
zinc_z13-Oct-07 7:00
zinc_z13-Oct-07 7:00 
QuestionUsing streamwriter into xls. file Pin
andredani13-Oct-07 4:11
andredani13-Oct-07 4:11 
AnswerRe: Using streamwriter into xls. file Pin
pmarfleet13-Oct-07 4:37
pmarfleet13-Oct-07 4:37 
GeneralRe: Using streamwriter into xls. file Pin
andredani13-Oct-07 5:12
andredani13-Oct-07 5:12 
GeneralRe: Using streamwriter into xls. file Pin
pmarfleet13-Oct-07 5:19
pmarfleet13-Oct-07 5:19 
GeneralRe: Using streamwriter into xls. file Pin
andredani13-Oct-07 6:16
andredani13-Oct-07 6:16 
GeneralRe: Using streamwriter into xls. file Pin
pmarfleet13-Oct-07 6:36
pmarfleet13-Oct-07 6:36 
GeneralRe: Using streamwriter into xls. file Pin
Giorgi Dalakishvili13-Oct-07 6:47
mentorGiorgi Dalakishvili13-Oct-07 6:47 
GeneralRe: Using streamwriter into xls. file Pin
Dave Kreskowiak13-Oct-07 9:21
mveDave Kreskowiak13-Oct-07 9:21 
GeneralRe: Using streamwriter into xls. file Pin
darkelv14-Oct-07 16:02
darkelv14-Oct-07 16:02 
GeneralRe: Using streamwriter into xls. file Pin
Dave Kreskowiak14-Oct-07 16:16
mveDave Kreskowiak14-Oct-07 16:16 
Questioncreate a .csv file using a variable as the name Pin
mocasu13-Oct-07 3:35
mocasu13-Oct-07 3:35 
AnswerRe: create a .csv file using a variable as the name Pin
Guffa13-Oct-07 4:04
Guffa13-Oct-07 4:04 
GeneralRe: create a .csv file using a variable as the name Pin
mocasu13-Oct-07 4:08
mocasu13-Oct-07 4:08 

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.