Design Pattern for Changing Object
Posted
by user210757
on Stack Overflow
See other posts from Stack Overflow
or by user210757
Published on 2010-05-14T22:25:08Z
Indexed on
2010/05/14
22:34 UTC
Read the original article
Hit count: 181
design-patterns
Is there a Design Pattern for supporting different permutations object?
Version 1
public class myOjbect {
public string field1 { get; set; } /* requirements: max length 20 */
public int field2 { get; set; }
. . .
public decimal field200 { get; set; }
}
Version 2
public class myObject {
public string field1 { get; set; } /* requirements: max length 40 */
public int field2 { get; set; }
. . .
public double field200 { get; set; } /* changed data types */
. . ./* 10 new properties */
public double field210 { get; set; }
}
of course I could just have separate objects, but thought there might be a good pattern for this sort of thing.
© Stack Overflow or respective owner