samedi 23 juillet 2016

c# Design Pattern for multiple property calculation

I have a list of MyClass and each item in this list has MyComplexObject list.

I have to derive/calculate values in MyClass like IsXyz, Rate etc... and then use these values to derive/calculate IsABC, IsValid etc. for each item in ComplexClass list item in MyClass.

Now deriving IsXyz or Rate or IsABC or IsValid have their own logic which in itself complex and hence need separate classes.

Which design pattern could be a best fit here?

class MyClass
    {
        public bool IsXyz { get; set; }
        public decimal ID { get; set; }
        public List<ComplexClass> MyComplexObject { get; set; }
        public double Rate { get; set; }
// Many more such props
    }

    class ComplexClass
    {
        public bool IsABC { get; set; }
        public decimal ID { get; set; }
        public double IsValid { get; set; }
// Many more such props
    }

Thanks

Aucun commentaire:

Enregistrer un commentaire