Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1022785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:31:01+00:00 2026-05-16T11:31:01+00:00

I have an object, lets call it UnSerializableObject, that I can’t and change that

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T11:31:02+00:00Added an answer on May 16, 2026 at 11:31 am

    When you add service reference it by default creates new object with the same structure in the namespace of your service reference. If you want to use shared converter you have to share object as well and reuse it during service referencing.

    Btw. WCF supports infrastructure for wrapping unserializable objects. Check IDataContractSuroggate.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say I have a Dictionary object: Dictionary myDictionary<int, SomeObject> = new Dictionary<string, SomeObject>();
Lets say I have a single object of type Car which I want to
When creating a web application, and lets say you have a User object denoting
Let's say I have a List object and an iterator for that list. Now
Let's say that you have overridden an object's equals() and hashCode() methods, so that
I have these container objects (let's call them Container) in a list. Each of
I have two objects, let's call them Input and Output Input has properties Input_ID
So I have an object graph, let's just say it's an order. You have
This is a contrived example, but lets say I have declared objects: CustomObj fooObj;
So let's say we have a domain object such as the following public class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.