Click here to Skip to main content
15,909,897 members
Home / Discussions / C#
   

C#

 
AnswerRe: unable to cast object of type 'X' to type 'X' Pin
Martin#9-Jul-07 6:02
Martin#9-Jul-07 6:02 
GeneralRe: unable to cast object of type 'X' to type 'X' Pin
Colin Angus Mackay9-Jul-07 7:16
Colin Angus Mackay9-Jul-07 7:16 
GeneralRe: unable to cast object of type 'X' to type 'X' Pin
PIEBALDconsult9-Jul-07 8:25
mvePIEBALDconsult9-Jul-07 8:25 
GeneralRe: unable to cast object of type 'X' to type 'X' Pin
Luc Pattyn9-Jul-07 8:35
sitebuilderLuc Pattyn9-Jul-07 8:35 
GeneralRe: unable to cast object of type 'X' to type 'X' Pin
Martin#9-Jul-07 8:41
Martin#9-Jul-07 8:41 
GeneralRe: unable to cast object of type 'X' to type 'X' Pin
PIEBALDconsult9-Jul-07 13:48
mvePIEBALDconsult9-Jul-07 13:48 
GeneralRe: unable to cast object of type 'X' to type 'X' Pin
Luc Pattyn9-Jul-07 14:18
sitebuilderLuc Pattyn9-Jul-07 14:18 
GeneralRe: unable to cast object of type 'X' to type 'X' Pin
Martin#9-Jul-07 8:51
Martin#9-Jul-07 8:51 
Hello,

Colin Angus Mackay wrote:
You can't instantiate an interface.

True, but what does that mean to his problem. Hmmm!
The method returns an IResponsableProcessingCSP instance and can not be casted too an derived class.
Would it have the same effect (exception) if it was originaly instanciated as on other derived class from IResponsableProcessingCSP?

Colin Angus Mackay wrote:
Perhaps there would be a situation where you do want an exception. Perhaps a case where the situation should never exist and so will be an exceptional case. Use "as" only when the posibility is frequent and expected.

Personaly, I would also use the as operator for that and check !=null, and throw my own Exception!
But that's maybe a matter of taste.

All the best,

Martin

GeneralRe: unable to cast object of type 'X' to type 'X' Pin
Colin Angus Mackay9-Jul-07 11:19
Colin Angus Mackay9-Jul-07 11:19 
GeneralRe: unable to cast object of type 'X' to type 'X' [modified] Pin
Martin#9-Jul-07 19:21
Martin#9-Jul-07 19:21 
GeneralRe: unable to cast object of type 'X' to type 'X' Pin
Martin#9-Jul-07 19:54
Martin#9-Jul-07 19:54 
GeneralRe: unable to cast object of type 'X' to type 'X' Pin
Vikram A Punathambekar9-Jul-07 17:50
Vikram A Punathambekar9-Jul-07 17:50 
GeneralRe: unable to cast object of type 'X' to type 'X' Pin
Martin#9-Jul-07 19:35
Martin#9-Jul-07 19:35 
GeneralRe: unable to cast object of type 'X' to type 'X' Pin
Martin#9-Jul-07 19:52
Martin#9-Jul-07 19:52 
GeneralRe: unable to cast object of type 'X' to type 'X' Pin
Vikram A Punathambekar9-Jul-07 20:16
Vikram A Punathambekar9-Jul-07 20:16 
GeneralRe: unable to cast object of type 'X' to type 'X' Pin
Martin#9-Jul-07 20:25
Martin#9-Jul-07 20:25 
GeneralRe: unable to cast object of type 'X' to type 'X' Pin
Vikram A Punathambekar9-Jul-07 22:08
Vikram A Punathambekar9-Jul-07 22:08 
GeneralRe: unable to cast object of type 'X' to type 'X' [modified] Pin
Martin#9-Jul-07 22:49
Martin#9-Jul-07 22:49 
GeneralRe: unable to cast object of type 'X' to type 'X' Pin
Vikram A Punathambekar10-Jul-07 0:47
Vikram A Punathambekar10-Jul-07 0:47 
GeneralRe: unable to cast object of type 'X' to type 'X' Pin
Martin#10-Jul-07 1:18
Martin#10-Jul-07 1:18 
GeneralRe: unable to cast object of type 'X' to type 'X' Pin
Vikram A Punathambekar10-Jul-07 4:30
Vikram A Punathambekar10-Jul-07 4:30 
GeneralRe: unable to cast object of type 'X' to type 'X' Pin
Martin#10-Jul-07 4:39
Martin#10-Jul-07 4:39 
AnswerRe: unable to cast object of type 'X' to type 'X' Pin
AFSEKI10-Jul-07 6:31
AFSEKI10-Jul-07 6:31 
QuestionSend a string to another program Pin
suntromantralalalala9-Jul-07 5:08
suntromantralalalala9-Jul-07 5:08 
AnswerRe: Send a string to another program Pin
Luc Pattyn9-Jul-07 6:51
sitebuilderLuc Pattyn9-Jul-07 6:51 

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.