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 8536545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:41:35+00:00 2026-06-11T10:41:35+00:00

I am wondering if I am missing anything here… My understanding is that I

  • 0

I am wondering if I am missing anything here… My understanding is that I should be able to get the ID property (but not set it) after deserializing. As it stands, the ID property is not brought along at all:

namespace CableSolve.Orders.Core.Dto
{
    [Serializable]
    [XmlRoot("Task"), SoapType("Task")]
    public class TaskDto : IDto
    {
        // ReSharper disable ConvertToAutoPropertyWithPrivateSetter
        private int _id;
        public int ID { get { return _id; } }
        // ReSharper restore ConvertToAutoPropertyWithPrivateSetter
        public int TaskSequence { get; set; }

        public TaskDto()
        {
        }
    }
}

Ideally my ID would not be settable. If I give the ID property an automatic, private setter — XML Serializer throws a fit. I thought the workaround for that was described here, but it does not appear to work for non-collections? I would prefer to not have to rewrite using DataContract at this point in time.

‘CableSolve.Web.Api.WorkflowServicesProxy.TaskDto’ does not contain a definition for ‘ID’ and no extension method ‘ID’ accepting a first argument of type ‘CableSolve.Web.Api.WorkflowServicesProxy.TaskDto’ could be found

  • 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-06-11T10:41:36+00:00Added an answer on June 11, 2026 at 10:41 am

    The deserialiser is just C# code. It requires a setter for a serialised property. Thus you must have a getter and setter for every property that is to be serialised by XML serializer; it also requires the property to be public.

    Also you do not need an empty constructor for the class.

    [Serializable]
    [XmlRoot("Task"), SoapType("Task")]
    public class TaskDto : IDto
    {
        public int ID { get; set; }
        public int TaskSequence { get; set; }
    }
    

    For more info, see http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.aspx

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

Sidebar

Related Questions

May have been asked before, but not that I could find. I'm simply wondering
Wondering what I'm missing here. Relatively new to C and iOS development, so please
I'm playing with RavenDb and wondering if I'm missing something obvious. Thing is, that
Wondering if there is any way to get the lambda expressions that result from
Can an insert ever execute without error but not insert anything? I am using
I was wondering what kind of exception should one throw for missing data. For
There may not be any real world use for this but i was wondering
I was just wondering if I was missing anything for the following question. I've
Wondering if any of you can help me: I've made a signup modal that
Wondering if anyone can suggest a good file replication tool that will replicate across

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.