다음을 통해 공유


DataContract names for Generic Types

When generating proxies for Data contracts that are generics types, we see that the hash of the name follows the types to avoid naming collision.To avoid this we can expose a type as follows

[

DataContract(Name="ShapeWithDimensionsIn{0})]
public class Shape<T>
{
}

So a type like Shape<float> gets translated to ShapeWithDimensionInfloat. Check out this article for a full explanation.

'{#}'  can be used to get the hash.

https://windowssdk.msdn.microsoft.com/en-us/library/ms731045.aspx