I have an object, lets call it UnSerializableObject, that I can't and change that I need to serialize. So I created my own object called SerializableObject that is serializable and contains all of the same data as the original object. which looks something like this:
namespace test  
[Serializable]  
class SerializableObject  
{  
    private int item1;  
    public int Item1  
    {  
        get;  
        set;  
    }  
    public SerializableObject()  
    {}  
}  
Then I created another class that converts to and from a SerializableObject and an UnSerializableObject. on the service side everything works fine. The method in the service takes a SerializableObject as a parameter and I convert it to an UnSerializableObject. The problem is on the client side. I used svcutil to create the client code. Then I take an Object convert it to a SerializableObject and use the SerializableObject in the service call. Like this:
  TTSServiceClient aClient = new TTSServiceClient(); 
        UnSerializableObject loMMessage = new MostMessage();
        SerializableObject loSMMessage = ObjectConverter.ToSerializableObject(loMMessage);
        aClient.Allocate_OnStartResultAck(loSMMessage);
When I compile the client I get the error:
Error 59 Argument '1': cannot convert from 'test.Utilities.SerializableObject [c:\Projects\Client\Client\test.Utilities.dll]' to 'test.Utilities.SerializableObject [C:\Projects\Client\Client\Service.cs(19)]'
static Class ObjectConverter
{
   static public SerializableObject ToSerializableObject(UnSerializableObject usObject)
   {   
        SerializableObject sObject = new SerializableObject();
        sObject.Item1 = usObject.Item1;
        return sObject;
   }
}
why is this happening? and how do I fix it? Is there a better way to handle this?