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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:08:37+00:00 2026-05-15T20:08:37+00:00

I am using WCF REST Start Kit for Visual Studio 2008 or .Net 3.5.

  • 0

I am using WCF REST Start Kit for Visual Studio 2008 or .Net 3.5. The example service will be able to get clean xml result like this:

<SampleItem>
  <Value>SampleValue</Value>
</SampleItem>

The SampleItem is a simple class with Value property in Service.scv.cs. Then I tried to use a customized class like

[global::System.Serializable()]
public class MyDomainClass {
   [global::System.Runtime.Serialization.DataMemberAttribute()]
   public string Name { get; set; }
   [global::System.Runtime.Serialization.DataMemberAttribute()]
   public double Value { get; set; }
   ...
}

Then I use this class to plug in to replace Service.svc.cs’ generic class:

 //public class Service : SingletonServiceBase<SampleItem>,
 //     ISingletonService<SampleItem>
 public class Service : SingletonServiceBase<MyDomainClass>,
      ISingletonService<MyDomainClass> {...}

It works fine but the XML result will look like:

<MyDomainClass>
   <_x003C_Name_x003E_k__BackingField>a name</_x003C_Name_x003E_k__BackingField>
   <_x003C_Value_x003E_k__BackingField>7.198</_x003C_Value_x003E_k__BackingField>
   ...

I think I have define a schema for my class so that XML might be clean like the example one. What I should do to get up my XML result in a clean or my expected 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. Editorial Team
    Editorial Team
    2026-05-15T20:08:37+00:00Added an answer on May 15, 2026 at 8:08 pm

    The easiest way to clean up the names of your xml entities is to specify the name property of the DataMemberAttribute:

    [Serializable, DataContract]    
    public class MyDomainClass 
    {
       [DataMember(Name="Name")]
       public string Name { get; set; }
    
       [DataMember(Name="Value")]
       public double Value { get; set; }
       ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using WCF REST Start kit to build a RESTFul service. I defined
I'm using the WCF Rest service application project template in visual studio. I'm just
I created a new wcf rest service using .net 4. I have created a
I am using WCF REST service (GET method) to retrieve my EF4 POCOs. The
I’m having a WCF REST service hosted in IIS using .NET 4 RC. The
I created a wcf Rest service using net framework 4 and IIS 6. I
I would like to start using the WCF Rest Starter Kit's HttpClient to build
I created a WCF REST (aka WebHttp) service in .NET 4, using Microsoft's WCF
I created a WCF rest service, then called that from javascript using ajax. Now
I'm new to REST and I'm building a service using the WCF REST Starter

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.