I have a type, let\'s call it Data
. I also have a WCF service contract that accepts a type (lets call it Wrapper
) with a property of type
A generic type is instantiable from a string, if the string follows this pattern: Class name followed by a "`" character, followed by the number of type parameters(in this case it's 1), followed by the type parameters enclosed within "[]", and using comma as type parameter separator.
Edit: I might also add, that if assembly information needs to be specified for the type parameters(althoug it's not the case for stuff in mscorlib), then nested "[]" is used.
Edit: You can customize names of generic types in data contracts, using the string format pattern.
[DataContract(Name = "Data{0}")]
public class Data
{...}
By default, the name generated for the Data
More here. Have a look at the "Customizing Data Contract Names for Generic Types" part down the page.