I'm serializing instances of a lot of classes (in C# 3.0), and I've found myself writing this:[DataContract]public class ModelClass{    public static Guid GetID(ModelClass instance) { ... }    public static T FromID<T>(Guid value) where T : ModelClass { }    [DataMember] public Guid m_id { get; set; }}[DataContract]public class ConcreteModel: ModelClass{    [DataMember]    public string      m_name;    // Stuff we don't serialize    public Sector      m_sector;    public Theater     m_theater;    public Weather     m_weather;    public TerrainType m_terrainType;    // Link serialized ids to real objects through GetID & FromID    [DataMember] private Guid m_sectorID    {        get { return GetID(m_sector); }        set { m_sector = FromID<Sector>(value); }    }    [DataMember] private Guid m_theaterID    {        get { return GetID(m_theater); }        set { m_theater = FromID<Theater>(value); }    }    [DataMember] private Guid m_weatherID    {        get { return GetID(m_weather); }        set { m_weather = FromID<Weather>(value); }    }    [DataMember] private Guid m_terrainTypeID    {        get { return GetID(m_terrainType); }        set { m_terrainType = FromID<TerrainType>(value); }    }}ConcreteModel is just one of many (~100) classes that will have some objects that are going to be saved using IDs, but not the whole objects, so we'll have to write that kind of properties a lot of times.Is there any way of avoiding this? In C++ I'd be using macros, but not in C#...My main concern here is not writing those properties all over again like 500 times or more. Any idea on how could I avoid that?
How could I reduce repetition with properties/methods?
c#;.net;serialization