Re: Casting of objects in different namespaces
Stephen Patten <[email protected]> Sat, 19 Jan 2008 16:51:56 -0800
| Newsgroups | gmane.comp.windows.devel.dotnet.web |
|---|---|
| Message-ID | <000301c85afe$a956cc10$fc046430$@com> |
Thanks Shawn! The Address class is the same across both objects , but just in different namespaces. I was hoping for a simple one liner, but it's looking like I'll have to write a mapper. Take Care! Stephen -----Original Message----- From: Discussion of building .NET applications targeted for the Web [mailto:[email protected]] On Behalf Of Shawn Wildermuth Sent: Saturday, January 19, 2008 3:52 PM To: [email protected] Subject: Re: Casting of objects in differnt namespaces There is unlikely to be an easy conversion unless the two Addresses are exactly the same. You'll likely need to create code to convert one to the other (and probably back). You won't be able to cast them since they are two different types...especially if they are un-related. For example, one Address might call Zipcode "ZIP" and another call it "PostalCode". You'll need to have code that can convert between the two and represent defaults for non-overlapping data (e.g. one has Country and the other one assumes the U.S.). GL Thanks, Shawn Wildermuth http://adoguy.com http://wildermuthconsulting.com Microsoft MVP (C#), MCSD.NET, Author and Speaker The Silverlight Tour is coming to a city near you! -----Original Message----- From: Discussion of building .NET applications targeted for the Web [mailto:[email protected]] On Behalf Of Stephen Patten Sent: Saturday, January 19, 2008 6:36 PM To: [email protected] Subject: [DOTNET-WEB] Casting of objects in differnt namespaces Hello, Don't know if that was the right title to give this but here goes.. Background: I have pulled down 2 web references into a 2.0 c# project. The author of the endpoints has created three classes, let's call them Agency, Advertiser, and Address and exposed Agency in one web reference and Advertiser in the other. Both an Agency, and Advertiser have an Address, and this is where the crux of my dilemma. How do I convert/cast an Agency.Address to an Advertiser.Address, or what terms should I be trying to research so that I may try to figure this out on my own? Thank you for your time, -- Stephen =================================== This list is hosted by DevelopMentor� http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor� http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com