.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

DataContractSerializer and xmlfiles with comments

Posted By:      Posted Date: October 04, 2010    Points: 0   Category :.NET Framework


I am using DataContractSerializer to serialize my classes into a xml file. This works fine. But now I want to put a comment into the first line of the xml file. Is there a way to do this (e.g. with XMLWriterSettings or something like this)?

Here is an example:

<!-- My Comment -->
<?xml version="1.0" encoding="utf-8"?>
<Unit xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Test">



View Complete Post

More Related Resource Links

MS Word style comments in asp.net



I need to create a system, that will be similar to ms word style comments. So the idea is the following: on the page there are a pack of text boxes labels and so on, and user need have the way to comment each control, and save commented text, for example to DB, so the others can reed comments too.

I tried PopUpControlExtender, but it works in single way, and i cannot view all the popups in one time. Or may be i missed something and there is a way to popup all the controls at one time? 

Therefore, are there any known solutions for a discribed task, based on PopUpControlExtender or something else?

Basic Instincts: Documenting Your Code With XML Comments


XML comments provide an easy and effective way to document your code. We'll show you how to use and customize XML comments in your Visual Basic projects.

Lisa Feigenbaum

MSDN Magazine May 2009

Toolbox: XML Comments, Online Payments, and More


This month, online payment processing services, XML comments the easy way, and more.

Scott Mitchell

MSDN Magazine June 2007

XML Comments: Document Your Code in No Time At All with Macros in Visual Studio


Starting in Visual Studio 2005, XML documentation support will become available in Visual Basic and C++ as it has been for C#. However, making full use of the many comment tags will take a little extra work In this article, the author shows how Visual Studio macros can be used to automate the creation of XML documentation and creates macros that write large sections of comments with just a keystroke.

Tony Chow

MSDN Magazine July 2005

C#: XML Comments Let You Build Documentation Directly From Your Visual Studio .NET Source Files


C# allows developers to embed XML comments into their source files-a useful facility, especially when more than one programmer is working on the same code. The C# parser can expand these XML tags to provide additional information and export them to an external document for further processing. This article shows how to use XML comments and explains the relevant tags. The author demonstrates how to set up your project to export your XML comments into convenient documentation for the benefit of other developers. He also shows how to use comments to generate help files.

J. Andrew Schafer

MSDN Magazine June 2002

how to develope a post and comments template like facebook



i want to develope desgin  like facebook .

where i have posts and comments will pick from the database that i inserted earlier.

what will be the best possible way to do in the same template.


Blog comments - Antispam protection


Do you know how to prevent from spam comments at a public blog made in sharepoint? Something like confirmation code woud be fine.



How to show previouse user comments on the task form of a user in sharepoint Designer

I am using sharepoint designer for designing workflow. I have 4 steps. on each step a user write some comments for the next user. now I want to show all those comments on task form for the current user to whom the task has been assigned.

DataContractSerializer do not verify "xml markup name" / "property name" correspondance

Hello, I use the DataContractSerializer o serialize / deserialize a complex class. During deserialisation, if an XML markup does not correspond to any property of my class, or if a property of the class is not present in the XML, there is not a single warning. This is problematic if a user make an invalid modification in the xml, or if a developer make a refactor in the code... How can I change this behavior ?   Thanks for your time.

DataContractSerializer deserialization puzzle - by-pass member initialization.

Hi, I was using WCF and during the transmission of a object, of the type Book, see code below, the deserialization process throws a NullReferenceException. To isolate the problem, I uses a unit test like this rather than involving the full blown WCF marshalling. This appears to be solely a serialization/deserialization problem and has nothing to do with the communication issues in WCF. [Test] public void TestSerializeAndDeserializeBook() {     Book book = new Book( "Testing Serialization and Deserialization",                         new Person( 100, "Tom", "Smith" ),                         new Person( 101, "Peter", "Pan" ) );     DataContractSerializer ser = new DataContractSerializer( typeof(Book) );     using( Stream stm = new MemoryStream() )     {         ser.WriteObject( stm, book );         stm.Seek( 0, SeekOrigin.Begin );         Book regen = ser.ReadObject( stm ) as Book; // NullReferenceException here     &nb

Comments in a report

I need to write and modify some comments in a report developed with SSRS 2005. The data model it’s a classic star schema. I have a dimension with 3 hierarchical levels that we can group at all levels and some values in the fact table. The user can write a comment in one, some or all rows of this report before print the report in PDF format. This comments don’t exists in the source system. My first idea it’s an exception to good practices of data warehousing (in the DW we can’t write extra data with forms ) and I want  to create a table that contains a key to join the correct row of report to the comment and a form to write this comments in the table. The report, after this update, can to be refreshed from data mart in join with my new table. I hope to be clear in my explanation and sorry for my horrible English. Other ideas?

How to post comments in blogs created on My Site sites

Hi all, I've been trying to comment in blogs created on My Site sites of other users in my SharePoint 2010 organization. But the only one allowed to comment a blog is the owner of the site. Does anyone knows how can I enable this option to other users? Thanks in advance for you help.

comments in svc-files

I've got a Question concerning svc-files. When I enter the URL of a svc-file in the Intenet Explorer it shows a automatically generated page like this: Is it possible to inculde comments in this page, e.g. XML-Comments from the service class or interface? Thanks for any replies.    

Getting a count of how many comments have been posted to an item (noteboard).

I have created a list, and added a noteboard to the DisplayForm.aspx page. The functionality works great, users can leave comments and the comments are associated with the selected item. The problem i'm having is accessing the content from the noteboard, Is there any way I could create a data view that retreives the number of comments associated with an item? The noteboard does not allow connections, so it makes it very difficult for me to send a comment count to another webpart.

Mulitple time and user stamped comments for each custom list row?

Does anything int he UI allow for this type of column to be added to a custom list? or would it have to be a seperate list? And on the subject of connecting two list to each other. Ideally, we would connect two lists by the list ID, having one list look up to another. But then the issue is having to know the ID.Anything in the UI allow a user to select one column, but save the ID for that as part of the lookup? Thanks.

xml nodes query on DataContractSerializer string

Hi I need to get a table from this xml, I have some experience using nodes but am getting nowhere on this string.  It is produced from DataContractSerializer on a list with one of the columns a dictionary.  Any help will be much appreciated!  declare @xml xml = ' <ArrayOfArmorDeviceBase xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://server.armor.com/contract/data">   <ArmorDeviceBase xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" z:Id="i1" i:type="ArmorSimpleDevice">     <Id>5000</Id>     <SiteId>0</SiteId>     <SourceSystem>Armor</SourceSystem>     <DataGroups xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">       <d3p1:KeyValueOfstringDeviceDataGroupBaseRRFhSxY9>         <d3p1:Key>CommunicationStatus</d3p1:Key>         <d3p1:Value xmlns:d5p1="http://server.armor.com/contract/data/ControllerStatus" i:type="d5p1:CommunicationStatus">           <Ticks>0</Ticks>           <d5p1:Status>Disco
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend