mardi 28 avril 2015

C# Post construction

I'm using the sqlite framework for windows phone applications to create system classes based on my database tables. I've expanded my system classes to include datatype properties that cannot be stored in the sql database.

Therefore I wish to set these properties after the construction of my classes, based on the input I receive from the database tables.

Is there a way invoke a method (Post constructor) immediately after the object of my class has been instantiated without making use of inheritance?

- Database Table (TestSubject)
- Id : Integer
- A : Integer
- B : Integer

- System Class (TestSubject)
- Id : Int
- A : Int
- B : Int
- C : Int //(Can I set this after the construction of the TestSubject object?)

Say I wanted to set C to be equal to A + B, I would have to wait for A and B to be set to do this though.

Aucun commentaire:

Enregistrer un commentaire