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.
[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