c# - Casting between inherited classed -



c# - Casting between inherited classed -

the next cast doent work. think should, can explain me why not? both webserviceerrormessage , btmacresponse inherit webservicemessage class

datalayer.webservicemessage msg = new service.webserviceerrormessage(ex) ; datalayer.btmacresponse macrsp = (datalayer.btmacresponse)msg;

unless webserviceerrormessage inherits btmacresponse, don't see why should work. you're trying cast value btmacresponse when object isn't btmacresponse.

to set way, expect able cast filestream memorystream because both inherit stream?

would expect able cast button string because both inherit object?

c# casting

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -