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

The Archive Base Latest Questions

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

I have the following types [Serializable, XmlType(Namespace=http://mycompany/foo] public sealed class Limit { [XmlElement(ElementName=Value1)] public

  • 0

I have the following types

[Serializable, XmlType(Namespace="http://mycompany/foo"]
public sealed class Limit
{
    [XmlElement(ElementName="Value1")]
    public double Value1 {get;set;}

    [XmlElement(ElementName="ComplexValue1")]
    public ComplexValue ComplexValue1 {get;set;}
}

[Serializable, XmlType(Namespace="http://mycompany/foo"]
public sealed class ComplexValue 
{
    [XmlElement(ElementName="Item1")]
    public double Item1 {get;set;}

    [XmlElement(ElementName="Item2")]
    public double Item2 {get;set;}
}

which I want to serialize to a .settings file.

When I copy the blob below into the settings file, I lose the ComplexValue1 element somehow:

<?xml version="1.0" encoding="utf-16"?>
<Limit>
  <Value1>20</Value1>
  <ComplexValue1>
     <Item1>2.0</Item1>
     <Item2>5.0</Item2>
  </ComplexValue1>
</Limit>

i.e. Visual Studio transforms it to:

<?xml version="1.0" encoding="utf-16"?>
<Limit>
<Value1>20</Value1>
</Limit>

with a bunch of namespaces that I think don’t matter for the question…

What am I missing?

  • 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:00:37+00:00Added an answer on May 16, 2026 at 11:00 am
    1. You don’t need the Serializable attribute for XML serialization

    2. I guess you should remove the XmlType attribute to solve the issue.

    3. You specify a namespace but there are none in the XML file? This should fit too.

    4. Use XmlRoot for the root node if you like

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

Sidebar

Related Questions

I have the following types and classes: namespace MVC.Models public class Page { public
I have the following classes [Serializable] [XmlRoot(fileset)] public class FileSet { [XmlArray()] [XmlArrayItem(ElementName=file)] public
I have the following code: Imports MySql.Data.MySqlClient Imports MySql.Data.Types Public Class FormMain Private Sub
Let's say I have the following code: public class Foo { private int x;
Have the following structure [Serializable] public class Parent { public int x = 5;
I have following entity class User: public class User implements Serializable { @Column(length =
I have the following entity in Hibernate: @Entity public class Contact implements Serializable {
I have following classes in my project. [Serializable] public class BaseEntityCollection<T> : List<T> where
Suppose I have the following types of data: class Customer { String id; //
Please consider the following three .NET types: I have an interface, an abstract 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.