G
Guest
I am working on a project that I would like to have some extensibility for
later. So with this I am using interfaces to pass objects to derived classes.
However I am running into a situation where two seperate classes won't cast
each other even though they implement the same interface. The classes are
identical yet won't convert. Here is (briefly) what I am talking about:
public interface IReturnObject
{
Guid ID { get; set; }
string Status { get; set; }
string Message { get; set; }
}
public class Result : IReturnObject
{
//implements code here
}
public class Response : IReturnObject
{
//implements code here
}
NOTE: The above two classes are in different namespaces such that Result is
in System.Application1.Result and Response is in System.Application.Response.
So when I use this in a client app and try to cast these two classes against
each other it compiles but at runtime I get "Specified cast is not valid"
with a System.ArguementException.
Any help would be greatly appreciated.
later. So with this I am using interfaces to pass objects to derived classes.
However I am running into a situation where two seperate classes won't cast
each other even though they implement the same interface. The classes are
identical yet won't convert. Here is (briefly) what I am talking about:
public interface IReturnObject
{
Guid ID { get; set; }
string Status { get; set; }
string Message { get; set; }
}
public class Result : IReturnObject
{
//implements code here
}
public class Response : IReturnObject
{
//implements code here
}
NOTE: The above two classes are in different namespaces such that Result is
in System.Application1.Result and Response is in System.Application.Response.
So when I use this in a client app and try to cast these two classes against
each other it compiles but at runtime I get "Specified cast is not valid"
with a System.ArguementException.
Any help would be greatly appreciated.