Discussion:
Casting of objects in differnt namespaces
Stephen Patten
2008-01-19 23:35:53 UTC
Permalink
Shawn Wildermuth
2008-01-19 23:51:42 UTC
Permalink
Stephen Patten
2008-01-20 00:51:56 UTC
Permalink
Dean Cleaver
2008-01-20 01:00:02 UTC
Permalink
I'd write to the developer, and see if they can provide the classes another way? Hard when you didn't write the code, but there must be some way they can provide them in the same namespace.

-----Original Message-----
From: Discussion of building .NET applications targeted for the Web [mailto:DOTNET-***@DISCUSS.DEVELOP.COM] On Behalf Of Stephen Patten
Sent: Sunday, 20 January 2008 13:52
To: DOTNET-***@DISCUSS.DEVELOP.COM
Subject: Re: [DOTNET-WEB] Casting of objects in different namespaces

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:DOTNET-***@DISCUSS.DEVELOP.COM] On Behalf Of Shawn Wildermuth
Sent: Saturday, January 19, 2008 3:52 PM
To: DOTNET-***@DISCUSS.DEVELOP.COM
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:DOTNET-***@DISCUSS.DEVELOP.COM] On Behalf Of Stephen Patten
Sent: Saturday, January 19, 2008 6:36 PM
To: DOTNET-***@DISCUSS.DEVELOP.COM
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 sub
Shawn Wildermuth
2008-01-20 01:41:11 UTC
Permalink
Chad Yost
2008-01-20 02:26:00 UTC
Permalink
Loading...