.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

Nesting serialized classes with XmlSerializer without escaped brackets

Posted By:      Posted Date: September 06, 2010    Points: 0   Category :.NET Framework
Hi The company I work for use a state implementation based on the XmlSerializer generic class in so far that we have state classes with simple public variables and no logic which we then use the XMLSerializer to serialize in in great extend nest. For instance class A has a Class B and a class C variable, each with a state class being serialized and put into a state class of the owner class. Is there any way outside actually implementing IXmlSerializable that I can allow to include XML directly in own output xml instead of escaping it when it meets brackets in strings for instance? The deal is that since all state classes individually are serialized simple classes, I know that they contain valid XML and that that will conform to the XMLDOM even if piecing them together and manually implementing the serializers will be quite time consuming even if limiting to the CSharp framework, but the multi layer escaped structure is awfull to the eye. See this simplified example: using System.Xml; using System.Xml.Serialization; using System; using System.IO; namespace TingTester { class Program { static void Main(string[] args) { var simpleser = new XmlSerializer(typeof(LittleStateClass)); string serialized = Serialize(GetSimpleVersion(), simpleser); Console.WriteLine("Simple elements contain no escapes: {0}", !serialized.Contains("&"

View Complete Post

More Related Resource Links

returning arrays of custom serialized classes



I have the following class:

  [XmlRoot("person", Namespace = "http://mme.se")]
  public class Person : IXmlSerializable
    public string FirstName;

    public static XmlQualifiedName MySchema(XmlSchemaSet xs)
      string xsd =
        @"<?xml version='1.0' encoding='utf-8'?>
<xs:schema id='person' 
 <xs:complexType name='personType'>
   <xs:element name='f' type='xs:string'/>

      var schemaSerializer = new XmlSerializer(

Learning C# and OOP, Classes

This is the second lesson in a miniseries designed to teach you how to write object-oriented programs using C#. This miniseries will describe and discuss the necessary and significant aspects of object-oriented programming (OOP) using C#.

InterFaces and Abstract Classes

Link Describes About Abstraction and Interfaces In Breif

MSDN Abstract Classes Link

MSDN Reference For Abstract Clases

Relation between classes in c# with class diagrams



Can anyone provide me an example of one to one and one two many relationship between classes in c# with class diagram and explationation.

Foundations: Extending the WPF Animation Classes


Learn what the WPF Animation Classes can do, what they can't, and how to extend them.

Charles Petzold

MSDN Magazine July 2007

CLR Inside Out: New Library Classes in "Orcas"


The next version of Visual Studio currently code-named "Orcas"supports advanced encryption algorithms, Elliptic curve cryptography, big integers, and other security enhancements. The CLR team explains.

Mike Downen, Inbar Gazit, and Justin Van Patten

MSDN Magazine April 2007

.NET Profiling: Write Profilers With Ease Using High-Level Wrapper Classes


Here Joachim H. Fröhlich and Reinhard Wolfinger show you how to get all the great functionality of the .NET Profiling API the easy way, with custom wrappers.

Joachim H. Fröhlich and Reinhard Wolfinger

MSDN Magazine April 2006

C#: Create Elegant Code With Anonymous Methods, Iterators, And Partial Classes


In this article Juval Lowy describes how exciting new features in Visual Studio 2005, that will improve your overall productivity compared to the first version of C#, so you can write cleaner code faster.

Juval Lowy

MSDN Magazine Visual Studio 2005 Guided Tour 2006

C# 2.0: Create Elegant Code with Anonymous Methods, Iterators, and Partial Classes


C# 2.0 introduces a wealth of exiting new features, such as generics, iterators, partial classes and anonymous methods. While generics are the most talked-about feature especially for former classic C++ developers, the rest of the new features are important additions to your .NET development arsenal, enhancing power and improving overall productivity. This article is dedicated to all the new C# 2.0 capabilities besides generics to give you a good overall picture of the upcoming features.

Juval Lowy

MSDN Magazine May 2004

Timers: Comparing the Timer Classes in the .NET Framework Class Library


Timers often play an important role in both client applications and server-based components (including Windows services). Writing effective timer-driven managed code requires a clear understanding of program flow and the subtleties of the .NET threading model. The .NET Framework Class Library provides three different timer classes: System.Windows.Forms.Timer, System.Timers.Timer, and System.Threading.Timer. Each of these classes has been designed and optimized for use in different situations. This article examines the three timer classes and helps you gain an understanding of how and when each class should be used.

Alex Calvo

MSDN Magazine February 2004

Zip Your Data: Using the Zip Classes in the J# Class Libraries to Compress Files and Data with C#


Zip compression lets you save space and network bandwidth when storing files or sending them over the wire. In addition, you don't lose the directory structure of folders you Zip, which makes it a pretty useful compression scheme. The C# language doesn't have any classes that let you manipulate Zip files, but since .NET-targeted languages can share class implementations, and J# exposes classes in the java.util.zip namespace, you can get to those classes in your C# code. This article explains how to use the Microsoft J# class libraries to create an application in C# that compresses and decompresses Zip files. It also shows other unique parts of the J# runtime you can use from any .NET-compliant language to save some coding.

Ianier Munoz

MSDN Magazine June 2003

Smart Cleanup: Achieve More Reliable Resource Management with Our Custom C++ Classes


Managing resources in C++ is not easy. When you're unsuccessful, your app can leak all kinds of resources including file system handles, database connections, and, of course, memory. Even in garbage-collected languages like Managed C++, resource management is difficult because garbage collection only deals with memory management, not the other resources that cause performance problems.In this article, the author describes the SmartAny template library he created, which uses a policy-based approach to dynamic resource management. Readers will learn how to use the SmartAny classes and policies to ensure the proper cleanup of their resources, be they files, OS handles, or native and unmanaged objects.

Eric Niebler

MSDN Magazine June 2003

C++ Q&A: Locking Column Headers, Implementing Singleton Classes


Prevent the sizing of the column headers in an ATL composite control. Also, see how you can share a small amount of simple data among multiple processes running on the same machine without Remoting.

Paul DiLascia

MSDN Magazine June 2003

Site Skinning: Rich XML Classes Let Users Personalize Their Visual Experience on Your ASP.NET Site


One way that Web sites and applications become better able to meet the needs of customers is by allowing them to personalize their experience. For Web sites, this means displaying the content as the user wants to see it. For rich-client applications, this often means allowing the user to choose the user interface through a technique known as skinning, which is similar to themes in Windows XP. This article shows how you can apply skinning to Web sites, wrapping their functionality in a new user interface. The technique uses the rich XML classes in the .NET Framework and the built-in extensibility of ASP.NET.

Harry Pierson

MSDN Magazine March 2003

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