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

  • Home
  • SEARCH
  • 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 73549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:13:09+00:00 2026-05-10T20:13:09+00:00

When I serialize; public class SpeedDial { public string Value { get; set; }

  • 0

When I serialize;

public class SpeedDial {     public string Value { get; set; }     public string TextTR { get; set; }     public string TextEN { get; set; }     public string IconId { get; set; } } 

It results:

<SpeedDial>     <Value>110</Value>     <TextTR>Yangın</TextTR>     <TextEN>Fire</TextEN>     <IconId>39</IconId> </SpeedDial> 

But what I want is this:

  <speedDial>     <value>110</value>     <text>       <TR>Yangın</TR>       <EN>Fire</EN>     </text>     <iconId>39</iconId>   </speedDial> 

I want to learn the canonical way…

  • 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. 2026-05-10T20:13:09+00:00Added an answer on May 10, 2026 at 8:13 pm

    Three approaches leap to mind:

    1: create a property to use for the serialization, and hide the others with [XmlIgnore] 2: implement IXmlSerializable and do it yourself 3: create a separate DTO just for the serialization

    Here’s an example that re-factors the ‘text’ portion into objects that XmlSerializer will like, while retaining the original public AIP:

    [Serializable] public class SpeedDial {     static void Main()     {         XmlSerializer ser = new XmlSerializer(typeof(SpeedDial));         SpeedDial foo = new SpeedDial { Value = '110', TextTR = 'Yangin',             TextEN = 'Fire', IconId = '39' };         ser.Serialize(Console.Out, foo);     }     public SpeedDial()     {         Text = new SpeedDialText();     }      [XmlElement('text'), EditorBrowsable(EditorBrowsableState.Never)]     public SpeedDialText Text { get; set; }      public string Value { get; set; }     [XmlIgnore]     public string TextTR     {         get { return Text.Tr; }         set { Text.Tr = value; }     }     [XmlIgnore]     public string TextEN     {         get { return Text.En; }         set { Text.En = value; }     }      public string IconId { get; set; } } [Serializable] public class SpeedDialText {     [XmlElement('EN')]     public string En { get; set; }     [XmlElement('TR')]     public string Tr { get; set; } } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 66k
  • Answers 66k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer I ran into this problem recently. It sounds like you… May 11, 2026 at 11:40 am
  • added an answer Check out my answer to this question: surfing with the… May 11, 2026 at 11:40 am
  • added an answer The File.Exists method exists primarily for testing for the existence… May 11, 2026 at 11:40 am

Related Questions

When I serialize; public class SpeedDial { public string Value { get; set; }
So I have a large 2d array that i serialize, but when I attempt
I'm getting the following error when I try to Serialize an HttpWebRequest Type 'System.Net.KnownHttpVerb'
When I use the XML serializer to serialize a DateTime , it is written
I had an odd problem today when I was trying to serialize an object.
I have an object I can serialize to XML without a problem. However when
I plan to serialize a Django model to XML when it's saved or updated.
When serializing, I would like to serialize an object only once, then any references
When I am writing code in Python, I often need to remove items from
When I try to run a .NET assembly ( boo.exe ) from a network

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.