Click here to Skip to main content
16,005,552 members
Home / Discussions / C#
   

C#

 
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 
AnswerRe: Syntax for passing methods without declaring a delegate Pin
Judah Gabriel Himango13-Oct-07 20:08
sponsorJudah Gabriel Himango13-Oct-07 20:08 
Domenic wrote:
string PerformOngoingOperation(MethodInvoker method)


Something like that, yeah.

One thing to keep in mind is, the C# 2 compiler can infer the delegate type. So if you define it with a MethodInvoker (or a SendOrPostCallback, or any other delegate), the compiler can infer the delegate from usage. For instance, you can call it like this:

Control.PerformOngoingOperation(Lib.Obj.Method); // where Lib.Obj.Method is a void, parameterless function


Notice how you didn't need to declare new MethodInvoker(Lib.Obj.Method), the C# compiler inferred that Lib.Obj.Method has a signature matching MethodInvoker, so you don't have to explicitly create a new delegate instance there. Does that help?

The reason this doesn't work with Control.PerformOngoingOperation(Delegate del, ...) is because the compiler doesn't know which delegate to use with it, so it forces you to create a new delegate around the function you pass in.


Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Feast of Tabernacles (audio)
The apostle Paul, modernly speaking: Epistles of Paul

Judah Himango


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 
GeneralRe: create a .csv file using a variable as the name Pin
mocasu13-Oct-07 4:12
mocasu13-Oct-07 4:12 

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.