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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:48:38+00:00 2026-05-28T13:48:38+00:00

i have the following class in C#. using System; using System.Collections.Generic; using Iesi.Collections.Generic; using

  • 0

i have the following class in C#.

using System;
using System.Collections.Generic;
using Iesi.Collections.Generic;
using System.Runtime.Serialization;

namespace PostIt.Models.Core
{
    [Serializable]
    [DataContract(Name = "Order")]
    public partial class Order
    {

        [DataMember]
        public virtual DateTime CreationDate
        {
            get;
            set;
        }

        [DataMember]
        public virtual string ReceiverName
        {
            get;
            set;
        }

        [DataMember]
        public virtual string Status
        {
            get;
            set;
        }

        [DataMember]
        public virtual int TrackingNumber
        {
            get;
            set;
        }

        [DataMember]
        public virtual Address Origin
        {
            get;
            set;
        }

        [DataMember]
        public virtual Address Destiny
        {
            get;
            set;
        }

        [DataMember]
        public virtual IList<Invoice> Invoices
        {
            get;
            set;
        }

        [DataMember]
        public virtual IList<Package> Packages
        {
            get;
            set;
        }

        [DataMember]
        public virtual IList<Stop> Stops
        {
            get;
            set;
        }

        /// <summary>
        /// Creador de la orden
        /// </summary>
        [DataMember]
        public virtual int IdPerson
        {
            get;
            set;
        }

        /// <summary>
        /// Ruta a la que pertenece
        /// </summary>
        [DataMember]
        public virtual int? IdRoute
        {
            get;
            set;
        }

        public Order()
        {
            Invoices = new List<Invoice>();
            Packages = new List<Package>();
            Stops = new List<Stop>();
        }

        public Order(int idRoute)
        {
            IdRoute = idRoute;
            Invoices = new List<Invoice>();
            Packages = new List<Package>();
            Stops = new List<Stop>();
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(this, obj))
                return true;

            return Equals(obj as Order);
        }

        public virtual bool Equals(Order obj)
        {
            if (obj == null) return false;

            if (Equals(CreationDate, obj.CreationDate) == false) return false;
            if (Equals(ReceiverName, obj.ReceiverName) == false) return false;
            if (Equals(Status, obj.Status) == false) return false;
            if (Equals(TrackingNumber, obj.TrackingNumber) == false) return false;
            return true;
        }

        public override int GetHashCode()
        {
            int result = 1;

            result = (result * 397) ^ (CreationDate != null ? CreationDate.GetHashCode() : 0);
            result = (result * 397) ^ (ReceiverName != null ? ReceiverName.GetHashCode() : 0);
            result = (result * 397) ^ (Status != null ? Status.GetHashCode() : 0);
            result = (result * 397) ^ TrackingNumber.GetHashCode();
            return result;
        }

        /// <summary>
        /// Retorna la suma del volumen de los paquetes de la orden
        /// </summary>
        /// <returns>Volumen total</returns>
        public virtual double TotalVolume()
        {
            double volume = 0;

            foreach(Package item in Packages)
            {

                volume += (double) item.Volume();
            }

            return volume;

        }

        /// <summary>
        /// Retorna la suma del peso de los paquetes de la orden
        /// </summary>
        /// <returns>Peso total</returns>
        public virtual double TotalWeight()
        {
            double weight = 0;

            foreach (Package item in Packages)
            {

                weight += (double)item.Weight;
            }

            return weight;

        }

    }
}

I’m building a REST web service with ASP.NET MVC 3. So i need to serialize this class in a XML and send it to the client. The problem is that i’m getting an annoying “d2p1” in every element of the XML. Here is an example of the response:

<RequestResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/PostIt.Result">
<Data i:type="d2p1:Order" xmlns:d2p1="http://schemas.datacontract.org/2004/07/PostIt.Models.Core">
    <d2p1:CreationDate>2013-04-27T00:00:00</d2p1:CreationDate>
    <d2p1:Destiny>
        <d2p1:Alias>La Casa del Lago</d2p1:Alias>
        <d2p1:City>Caracas</d2p1:City>
        <d2p1:Country>Venezuela</d2p1:Country>
        <d2p1:HouseName>Qta. Frescia</d2p1:HouseName>
        <d2p1:HouseNumber>20</d2p1:HouseNumber>
        <d2p1:IdAddress>2</d2p1:IdAddress>
        <d2p1:IdPerson>1</d2p1:IdPerson>
        <d2p1:InUse>false</d2p1:InUse>
        <d2p1:Latitude>10.49102</d2p1:Latitude>
        <d2p1:Longitude>-66.90206</d2p1:Longitude>
        <d2p1:Street>Av. Principal Santa Marta</d2p1:Street>
        <d2p1:Urbanization>Santa Marta</d2p1:Urbanization>
        <d2p1:ZipCode>1061</d2p1:ZipCode>
    </d2p1:Destiny>
    <d2p1:IdPerson>1</d2p1:IdPerson>
    <d2p1:IdRoute>1</d2p1:IdRoute>
    <d2p1:Invoices/>
    <d2p1:Origin>
        <d2p1:Alias>Mi casa</d2p1:Alias>
        <d2p1:City>Caracas</d2p1:City>
        <d2p1:Country>Venezuela</d2p1:Country>
        <d2p1:HouseName>Qta. Frescia</d2p1:HouseName>
        <d2p1:HouseNumber>20</d2p1:HouseNumber>
        <d2p1:IdAddress>1</d2p1:IdAddress>
        <d2p1:IdPerson>1</d2p1:IdPerson>
        <d2p1:InUse>true</d2p1:InUse>
        <d2p1:Latitude>48.89364</d2p1:Latitude>
        <d2p1:Longitude>2.33739</d2p1:Longitude>
        <d2p1:Street>Av. Principal Santa Marta</d2p1:Street>
        <d2p1:Urbanization>Santa Marta</d2p1:Urbanization>
        <d2p1:ZipCode>1061</d2p1:ZipCode>
    </d2p1:Origin>
    <d2p1:Packages>
        <d2p1:Package>
        <d2p1:Content>Electronicos</d2p1:Content>
        <d2p1:Height>10.2</d2p1:Height>
        <d2p1:IdPackage>1</d2p1:IdPackage>
        <d2p1:OrderTrackingNumber>1957437</d2p1:OrderTrackingNumber>
        <d2p1:Thicknes>1.3</d2p1:Thicknes>
        <d2p1:Weight>2</d2p1:Weight>
        <d2p1:Width>5.3</d2p1:Width>
        </d2p1:Package>
        <d2p1:Package>
        <d2p1:Content>Electronicos</d2p1:Content>
        <d2p1:Height>4.8</d2p1:Height>
        <d2p1:IdPackage>2</d2p1:IdPackage>
        <d2p1:OrderTrackingNumber>1957437</d2p1:OrderTrackingNumber>
        <d2p1:Thicknes>3.4</d2p1:Thicknes>
        <d2p1:Weight>8</d2p1:Weight>
        <d2p1:Width>9.2</d2p1:Width>
        </d2p1:Package>
        <d2p1:Package>
        <d2p1:Content>Electronicos</d2p1:Content>
        <d2p1:Height>15.1</d2p1:Height>
        <d2p1:IdPackage>3</d2p1:IdPackage>
        <d2p1:OrderTrackingNumber>1957437</d2p1:OrderTrackingNumber>
        <d2p1:Thicknes>2.6</d2p1:Thicknes>
        <d2p1:Weight>6</d2p1:Weight>
        <d2p1:Width>3.3</d2p1:Width>
        </d2p1:Package>
    </d2p1:Packages>
    <d2p1:ReceiverName>Pepito</d2p1:ReceiverName>
    <d2p1:Status>Recolectada</d2p1:Status>
    <d2p1:Stops>
        <d2p1:Stop>
        <d2p1:Alias>La esquina del mono</d2p1:Alias>
        <d2p1:City>Barcelona</d2p1:City>
        <d2p1:Country>Espana</d2p1:Country>
        <d2p1:IdOrder>1957437</d2p1:IdOrder>
        <d2p1:IdStop>1</d2p1:IdStop>
        <d2p1:State>Catalunia</d2p1:State>
        </d2p1:Stop>
        <d2p1:Stop>
        <d2p1:Alias>Al lado de Farmatodo</d2p1:Alias>
        <d2p1:City>Caracas</d2p1:City>
        <d2p1:Country>Venezuela</d2p1:Country>
        <d2p1:IdOrder>1957437</d2p1:IdOrder>
        <d2p1:IdStop>2</d2p1:IdStop>
        <d2p1:State>Distrito Capital</d2p1:State>
        </d2p1:Stop>
        <d2p1:Stop>
        <d2p1:Alias>La parada Loca</d2p1:Alias>
        <d2p1:City>San Diego</d2p1:City>
        <d2p1:Country>USA</d2p1:Country>
        <d2p1:IdOrder>1957437</d2p1:IdOrder>
        <d2p1:IdStop>3</d2p1:IdStop>
        <d2p1:State>California</d2p1:State>
        </d2p1:Stop>
    </d2p1:Stops>
    <d2p1:TrackingNumber>1957437</d2p1:TrackingNumber>
</Data>
<ErrorCode>1</ErrorCode>
<Message>SUCCESS</Message>
</RequestResult>

How do i get rid of the d2p1?

  • 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-28T13:48:38+00:00Added an answer on May 28, 2026 at 1:48 pm

    Qualify your DataContract with the “Namespace” Attribute, and then use the same namespace name.
    Like this:

    namespace PostIt
    {
        [DataContract(Name = "ResultRequest", Namespace = "YourNamespace")]
        public class Result
        {
            [DataMember]
            Models.Core.Order order;
            [DataMember]
            int ErrorCode;
            [DataMember]
            String Message;
            ...
        }
        namespace Models.Core
        {
            [Serializable]
            [DataContract(Name = "Order", Namespace = "YourNamespace")]
            public partial class Order
            {
                ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; namespace
Suppose I have the following class: using System; using System.Collections.Generic; using System.Linq; using System.Text;
I have the following code : using System.Collections.Generic; public class Test { static void
I currently have a class file with the following enumeration: using System; namespace Helper
i have the following code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using
i have the following code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using
Given the following code: using System.Collections.Generic; static class Program { static void Main() {
I have summarized my problem in following code snippet using System; using System.Collections.Generic; using
I have summarized my problem in following code snippet. using System; using System.Collections.Generic; using
I have the following code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using

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.