0

If I have the code:

public class Person
{
    public string FirstName { get; set; }
    public string LastName { get; set; }
}

How do I convert it to the code below at runtime or compile time?

[DataContract]
public class Person
{
    [DataMember]
    public string FirstName { get; set; }
    [DataMember]
    public string LastName { get; set; }
}

Can I do this using DynamicProxy? Cecil? or some other open source project?

BuddyJoe
  • 69,735
  • 114
  • 291
  • 466
  • 1
    Why do you want to do this? There are many other ways to avoid marking up a POCO if it is just the syntax that you don't care for - `XmlSerializer` being one of them. – Mitch Nov 07 '13 at 20:36
  • Does that have any limitations within WCF by doing it that way? But yes, I also just wanted to know how to do this kind of manipulation even if there is a better/easier way to do it. – BuddyJoe Nov 07 '13 at 23:43

0 Answers0