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


Post New Web Links

XML Class Serialization with dynamic XmlElementName

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

Hi dudes, I have a question:

 

Today I have the following scenario:

 

 [XmlRoot("Etiquetas")]
 public class Etiquetas : List<Etiqueta>
 {

 } 

 public class Etiqueta
 {
 private string _id;
 private string _ptbr;
 private string _enus;

 [XmlAttribute]
 public string id
 {
 get { return _id; }
 set { _id = value; }
 }

 [XmlElement("pt-br")]
 public string pt_br
 {
 get { return _ptbr; }
 set { _ptbr = value; }
 


View Complete Post


More Related Resource Links

Class To Contract: Enrich Your XML Serialization With Schema Providers In The .NET Framework

  

The Microsoft .NET Framework 1.x provided minimal options for mapping classes to schemas and serializing objects to XML documents, making this sort of mapping quite a challenge. The .NET Framework 2.0 changes all this with Schema providers and the IXmlSerializable interface.

Keith Pijanowski

MSDN Magazine June 2006


Dynamic Class with Linq query Result

  
Hi, var   query = db.Customers.Where( "City == @0 and Orders.Count >= @1", "London", 10). OrderBy( "CompanyName"). Select( "New(CompanyName as Name, Phone)");    I am using this query as a sample which returns a dynamicclass type, and i need this should to converted to a list collections or datatable etc., As i am holding it in my wcf service with linqtosql as dataaccesslayer. Trying to send the results to the UI which i have consumes this service. Kindly help me in this. Thanks query = db.Customers

Customizing class serialization for dissimilar clients

  
In my class (with DataContract attribute) some properties,  [DataMember( Name = "Name",Order = 1)] are used by existing WCF clients. Now, I need to modify/supplement it to have only _some_ of these properties  to be serialized/deserialized on behalf a new non-WCF client, while not disrupting the existing WCF clients' functionality. What would be your choice: to use OnSerializing/ISerializable (how  to avoid serializing some properties?), to go SurrogateSelector way or to use something else for non-WCF client, like XmlSerializer, LINQ to XML, or something else.  One complication is that I would need for my non-WCF client to modify XML output into a a customer XML format (KLM),  while preserving serialization order and hierarchy. Which way would require less effort and/or provide more flexibility? I am using .NET 3.5 SP1 -Nick

Xml Serialization: choose tag name for class instances in a generic ObservableCollection / List

  

Hi,

I've creating a class called Graphics, deriving from a generic ObservableCollection where T is a custom class called Graphic :

public class Graphics : ObservableCollection<Graphic>
{
public Graphics()
{
}
}

Another class has a Graphics field. When I serialize to XML this class, this works fine :

<MyOtherClassInstance>
 <Graphics>
  <Graphic id="1">
  <Graphic id="2">
  <Graphic id="3">
 </Graphics>
</MyOtherClassInstance>

But I would like to have the following:

<MyOtherClassInstance>
 <Gs>
  <Gr id="1">
  <Gr id="2">
  <Gr id="3">
 </Gs>
</MyOtherClassInstance>

How can I process, I can't find a solution.

Please help.

Thanks


Xml Serialization: change tag name of class instances in a generic ObservableCollection / List

  

Hi,

I've creating a class called Graphics, deriving from a generic ObservableCollection where T is a custom class called Graphic :

public class Graphics : ObservableCollection<Graphic>
{
public Graphics()
{
}
}

Another class has a Graphics field. When I serialize to XML this class, this works fine :

<MyOtherClassInstance>
 <Graphics>
  <Graphic id="1">
  <Graphic id="2">
  <Graphic id="3">
 </Graphics>
</MyOtherClassInstance>

But I would like to have the following:

<MyOtherClassInstance>
 <Gs>
  <Gr id="1">
  <Gr id="2">
  <Gr id="3">
 </Gs>
</MyOtherClassInstance>

How can I process, I can't find a solution.

Please help.

Thanks


how to inherit a dynamic class from existing base class in C#?

  
i have created   dynamic class using CodeDom,but now i,want to inherit the dynamic class from my base class...becoz i have created methods in my base class n now i want to inherits these methods from that base clss in  my new dynamic class....plzzzzzzzzzzzz someone help me i have search alottt but didnt find any piece of code...i also tried reflection.emit but i face same problem in Reflection.emit...so plz help me..

Adding Dynamic Rows in ASP.NET GridView Control with TextBoxes and with Delete functionality

  
In my previous examples, I have demonstrated on how to add dynamic rows in GridView control with TextBoxes and how to save the values into the database. Now, seems that most of the developers are asking if how to add a delete functionality with it. So in this example, I'm going to show on how to delete a certain row in the dynamic GridView with TextBoxes.

Dynamic Data Templates in GridView ASP.NET 3.5

  
At a high level, Dynamic Data Templates can be seen as a system to very quickly build up a User Interface linked with the relevant data model, immediately enabling you to perform CRUD operations (Create, Read, Update, Delete) on the database using the specified data source. They provide a powerful method for building up these kinds of applications, and I'm going to focus on an overview of what Dynamic Data Templates actually are, and a few ways of customizing them to suit industry needs.

Class Diagrams

  
Class diagrams show the static structure of the systems. Classes define the properties of the objects which belong to them. These include:

Attributes - (second container) the data properties of the classes including type, default value and constraints.

Creating a Simple Class in C#

  
The second article in the C# Object-Oriented Programming tutorial describes how classes are created in C# and how behaviour, in the form of publicly visible and private, hidden methods can be added. This demonstrates some of the uses of encapsulation

ASP.NET 4.0 Dynamic Data and Many to Many Entity Framework Entities

  
I did not play much with Dynamic Data controls in VS2008 and just made a cool discovery in VS2010 Beta 2. This may not even be new, but as I'm sitting 30,000+ feet over the Atlantic ocean, I don't have access to VS2008 at the moment to check.

Static Class for Beginners

  
In general, the members of a class can be accessed by instance of that class when they are in public, but there comes a situation to access or call members of a class without an instance and this can be achieved by declaring them as static

Dynamic Systems Development Model (DSDM) Methodology

  
The Dynamic Systems Development Model was developed in the U.K. in the mid-1990s. It is the evolution of rapid application development (RAD) practices. DSDM boasts the best-supported training and documentation of any of the agile software development techniques, at least in Europe. DSDM favors the philosophy that nothing is built perfectly the first time and looks to software development as an exploratory endeavor.

Adding Dynamic Rows in GridView with TextBoxes

  
I decided to write this article because this has been asked so many times before at the forums(http://forums.asp.net) . Basically, this example shows on how to generate a Row in GridView with TextBoxes when clicking a Button that is residing inside a GridView Footer.

Adding Dynamic Rows in GridView with TextBoxex in C#

  
I decided to write this article because this has been asked so many times before at the forums(http://forums.asp.net) . Basically, this example shows on how to generate a Row in GridView with TextBoxes when clicking a Button that is residing inside a GridView Footer.

What is the difference between "dynamic" and "object" keywords?

  
Let's take a quick look at the object keyword first. I'm not going to talk a lot about it because it's been around since C# 1.0. This keyword is nothing more than a shortcut for System.Object, which is the root type in the C# class hierarchy. (However, as Eric Lippert pointed out in his blog post, not everything in C# derives from object.) This is a powerful mechanism, since you can assign almost any value to instances of this type.

Dynamic in C# 4.0: Introducing the ExpandoObject

  
You have probably already heard about the new dynamic feature in C# 4.0 and how it is used to support COM interop. If you haven't, I strongly recommend reading the following MSDN articles: Using Type dynamic and How to: Access Office Interop Objects by Using Visual C# 2010 Features.
Categories: 
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