Click here to Skip to main content
15,917,997 members
Home / Discussions / C#
   

C#

 
AnswerRe: C# TCP networkstreem problem Pin
Luc Pattyn2-Oct-09 3:06
sitebuilderLuc Pattyn2-Oct-09 3:06 
AnswerRe: C# TCP networkstreem problem Pin
0x3c02-Oct-09 3:56
0x3c02-Oct-09 3:56 
AnswerRe: C# TCP networkstreem problem Pin
Tr@v2-Oct-09 16:26
Tr@v2-Oct-09 16:26 
GeneralRe: C# TCP networkstreem problem Pin
Titok Levi6-Oct-09 22:03
Titok Levi6-Oct-09 22:03 
QuestionGenerics, delegates and type inference Pin
dojohansen2-Oct-09 2:10
dojohansen2-Oct-09 2:10 
AnswerRe: Generics, delegates and type inference Pin
Gideon Engelberth2-Oct-09 6:29
Gideon Engelberth2-Oct-09 6:29 
GeneralRe: Generics, delegates and type inference Pin
dojohansen2-Oct-09 7:43
dojohansen2-Oct-09 7:43 
GeneralRe: Generics, delegates and type inference Pin
Gideon Engelberth2-Oct-09 13:00
Gideon Engelberth2-Oct-09 13:00 
WSDL and all of that is way outside of my experience (and doesn't seem to be something you are really having questions about, just complaints), so I won't speak to that.

Doing a search for "generic delegate inference" showed other people that were having the same problem as you, along with some explanations I will rephrase here. I'm sure I've run into the problem before and just don't remember where. The problem seems to come down to the compiler having to infer too many things at once. The rest of this post is how I assume the general flow of compilation goes, but I am by no means an authority on the compiler.

When you say Invoke(globalService.logout), the compiler first has to guess what type to make globalService.logout, before it can determine what types to use for Invoke. It will then look to the method signature of Invoke to try to determine what type of delegate to create from the method group globalService.logout. It will see that it is based on a generic parameter, so it can't make any assumptions there. In this case, there is only one possible overload of logout, but there could be more logout definitions, and then there would be no way to know which one you want. The compiler team probably decided it wasn't worth adding the special case for when you have only one overload. One reason against that feature would be that adding an overload to the method would suddenly break previously working code.

Since there are no other parameters, the compiler has no more information to help it determine what types to fill in for the generic declaration and gives up. If you were to change Invoke to be Invoke<TRequest, TRepsone>(Func<TRequest, TResponse> method, TRequest param), the compiler would then figure it out from the second parameter. It can determine this because you are not allowed to overload methods solely by return type. Thus when it sees the second parameter is, for example, string, the first parameter becomes Func<string, TResponse> which is apparently just enough for it to do the rest of the work itself. As you might guess, giving Invoke a parameter of TResponse will not clear up the error (because you could still have multiple definitions that would match).
QuestionInheritance question Pin
xkrja1-Oct-09 23:35
xkrja1-Oct-09 23:35 
AnswerRe: Inheritance question Pin
stancrm1-Oct-09 23:49
stancrm1-Oct-09 23:49 
GeneralRe: Inheritance question Pin
xkrja2-Oct-09 0:22
xkrja2-Oct-09 0:22 
GeneralRe: Inheritance question Pin
Mirko19802-Oct-09 0:57
Mirko19802-Oct-09 0:57 
AnswerRe: Inheritance question Pin
Christian Graus2-Oct-09 0:40
protectorChristian Graus2-Oct-09 0:40 
AnswerRe: Inheritance question Pin
DaveyM692-Oct-09 0:46
professionalDaveyM692-Oct-09 0:46 
AnswerRe: Inheritance question Pin
dojohansen3-Oct-09 1:12
dojohansen3-Oct-09 1:12 
QuestionStream System Sound to A GSM MODEM Pin
aghoshbabu1-Oct-09 23:09
aghoshbabu1-Oct-09 23:09 
AnswerRe: Stream System Sound to A GSM MODEM Pin
Rutvik Dave2-Oct-09 4:27
professionalRutvik Dave2-Oct-09 4:27 
QuestionDotNetOpenMail Authentication Pin
DotNetCoderJunior1-Oct-09 22:52
DotNetCoderJunior1-Oct-09 22:52 
AnswerRe: DotNetOpenMail Authentication Pin
Christian Graus1-Oct-09 23:05
protectorChristian Graus1-Oct-09 23:05 
GeneralRe: DotNetOpenMail Authentication Pin
DotNetCoderJunior1-Oct-09 23:23
DotNetCoderJunior1-Oct-09 23:23 
GeneralRe: DotNetOpenMail Authentication Pin
Tom Deketelaere2-Oct-09 0:25
professionalTom Deketelaere2-Oct-09 0:25 
GeneralRe: DotNetOpenMail Authentication Pin
dojohansen3-Oct-09 1:18
dojohansen3-Oct-09 1:18 
GeneralRe: DotNetOpenMail Authentication Pin
Christian Graus2-Oct-09 0:41
protectorChristian Graus2-Oct-09 0:41 
JokeRe: DotNetOpenMail Authentication Pin
Tom Deketelaere2-Oct-09 2:27
professionalTom Deketelaere2-Oct-09 2:27 
QuestionC# 4.0: Dynamic Programming - usage question Pin
Ekaterina Staykova1-Oct-09 21:47
Ekaterina Staykova1-Oct-09 21:47 

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.