Pages

Men

rh

7/06/2012

How do we customize Data Contract Names for Generics types?

We can customize the generic datacontract names by allowing parameters. Find the Example below

[DataContract(Name = "Shape_{1}_brush_and_{0}_shape")]
public class Shape< Square,RedBrush>
{
// Code not shown.
}

Here, the Data Contract Name is "Shape_RedBrush_brush_and_Square_shape”
{0} – First Parameter in the generic type.
{1}- Second Parameter in the generic type.

No comments :

Post a Comment