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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:44:05+00:00 2026-06-10T10:44:05+00:00

I have developed an ASP.NET Web API which response like this: <ArrayOfMyData> <MyData> <Id>1</Id>

  • 0

I have developed an ASP.NET Web API which response like this:

<ArrayOfMyData>
    <MyData>
         <Id>1</Id>
         <Name>x</Name>
    </MyData>
    <MyData>
         <Id>2</Id>
         <Name>y</Name>
    </MyData>
    <MyData>
         <Id>3</Id>
         <Name>z</Name>
    </MyData>
</ArrayOfMyData>

I want to add an attribute to the root element, so the response looks like:

<ArrayOfMyData MyAttribute="bela bela bela">
    .
    .
    .
</ArrayOfMyData>
  • 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-10T10:44:07+00:00Added an answer on June 10, 2026 at 10:44 am

    You would need to use XmlSerializer for this as it provides greater control over your output. By default Web API’s XmlMediaTypeFormatter uses DataContractSerializer, which does not generate attributes. To switch to XmlSerializer, you can set the flag on property: UseXmlSerializer:
    Why are attributes not supported with the DataContractSerializer?

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

Sidebar

Related Questions

I have developed one asp.net web application and now i would like to add
I have developed an ASP.NET web application in visual studio 2008. I want to
I have developed an web application using Asp.net ( .Net Framework 3.0). In this
I have developed a multilingual web application with Asp.Net. I want to a question
I have developed one ASP.NET (C#) web application in Framework 4. I want to
I have two web applications and both are developed in ASP.NET. Now I want
I have developed a web application in asp.net, there is a page in this
i have developed a web application asp.net C#. on a button click i am
I have a asp.net web site that was developed on the .Net Framework v2
I have developed a MVC web application with ASP.NET MVC and im just wondering

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.