Defining DataContract and DataMember dynamically in Generic Classes
<p>I want to create a generic class in C# and control the way it is serialized by defining its <code>[DataContract]</code> and <code>[DataMember]</code> attributes dynamically, according to the generic type parameter used in the constructor.</p>

<p>Is there a way to do so? Can we define those atributes in runtime using reflection in the generic class constructor?</p>