Click here to Skip to main content
15,896,207 members
Home / Discussions / C#
   

C#

 
GeneralRe: Cast Action to Action Pin
PIEBALDconsult31-Mar-11 2:57
mvePIEBALDconsult31-Mar-11 2:57 
GeneralRe: Cast Action to Action Pin
Eddy Vluggen31-Mar-11 3:05
professionalEddy Vluggen31-Mar-11 3:05 
GeneralRe: Cast Action to Action Pin
J4amieC31-Mar-11 3:38
J4amieC31-Mar-11 3:38 
GeneralRe: Cast Action to Action Pin
Eddy Vluggen31-Mar-11 3:45
professionalEddy Vluggen31-Mar-11 3:45 
GeneralRe: Cast Action to Action Pin
J4amieC31-Mar-11 5:46
J4amieC31-Mar-11 5:46 
GeneralRe: Cast Action to Action Pin
Eddy Vluggen31-Mar-11 7:00
professionalEddy Vluggen31-Mar-11 7:00 
GeneralRe: Cast Action to Action Pin
PIEBALDconsult31-Mar-11 15:00
mvePIEBALDconsult31-Mar-11 15:00 
AnswerRe: Cast Action to Action Pin
Pete O'Hanlon30-Mar-11 22:34
mvePete O'Hanlon30-Mar-11 22:34 
The reason you can't do it is fairly simple. Action<T> is generic - fair enough, and you want it to be Action<object> - ok? Simplistically you would think this would work because no matter what type T was, it would ultimately be convertable to object, as everything derives from object.

Suppose though, that type T was a string, and you wanted to use Action<int> - all of a sudden, there's a conversion that is not implicitly possible - in other words, you would have to perform an explicit cast. The cast into object would have to be a special case in the compiler, so they chose not to do this - instead, like for like typing is the only way to achieve this.

I'm not a stalker, I just know things. Oh by the way, you're out of milk.

Forgive your enemies - it messes with their heads


My blog | My articles | MoXAML PowerToys | Onyx


GeneralRe: Cast Action to Action Pin
Adriaan Davel30-Mar-11 22:46
Adriaan Davel30-Mar-11 22:46 
GeneralRe: Cast Action to Action Pin
Pete O'Hanlon30-Mar-11 23:21
mvePete O'Hanlon30-Mar-11 23:21 
GeneralRe: Cast Action to Action Pin
Adriaan Davel30-Mar-11 23:52
Adriaan Davel30-Mar-11 23:52 
GeneralRe: Cast Action to Action Pin
Eddy Vluggen31-Mar-11 0:03
professionalEddy Vluggen31-Mar-11 0:03 
GeneralRe: Cast Action to Action Pin
RobCroll31-Mar-11 2:32
RobCroll31-Mar-11 2:32 
AnswerRe: Cast Action to Action Pin
J4amieC30-Mar-11 23:22
J4amieC30-Mar-11 23:22 
AnswerRe: Cast Action to Action Pin
BobJanova30-Mar-11 23:28
BobJanova30-Mar-11 23:28 
AnswerRe: Cast Action to Action Pin
Rob Philpott31-Mar-11 1:39
Rob Philpott31-Mar-11 1:39 
GeneralRe: Cast Action to Action Pin
PIEBALDconsult31-Mar-11 2:59
mvePIEBALDconsult31-Mar-11 2:59 
GeneralRe: Cast Action to Action Pin
Rob Philpott31-Mar-11 3:24
Rob Philpott31-Mar-11 3:24 
QuestionSolution directory Pin
Helfdane30-Mar-11 11:59
Helfdane30-Mar-11 11:59 
AnswerRe: Solution directory Pin
Luc Pattyn30-Mar-11 12:08
sitebuilderLuc Pattyn30-Mar-11 12:08 
GeneralRe: Solution directory Pin
Helfdane30-Mar-11 21:17
Helfdane30-Mar-11 21:17 
GeneralRe: Solution directory Pin
Luc Pattyn30-Mar-11 22:06
sitebuilderLuc Pattyn30-Mar-11 22:06 
GeneralRe: Solution directory Pin
Helfdane30-Mar-11 22:08
Helfdane30-Mar-11 22:08 
AnswerRe: Solution directory Pin
Eddy Vluggen30-Mar-11 12:24
professionalEddy Vluggen30-Mar-11 12:24 
AnswerRe: Solution directory Pin
RobCroll30-Mar-11 13:46
RobCroll30-Mar-11 13:46 

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.