c# - When are Property Imports Satisfied? -


when property imports satisfied? thought satisfied before constructor, properties initialized before constructor runs, following example shows importedclass null in constructor.

i know can resolve using importingconstuctor; sake of understanding when property imports satisfied.

public myclass {   [import]   public importedclass importedclass {get;set;}    public myclass()   {       //imported class null @ point, nothing can done here.   } } 

an object cannot manipulated before constructor being called. mef provides solution problem though, interface called ipartimportssatisfiednotification

public myclass : ipartimportssatisfiednotification {   [import]   public importedclass importedclass {get;set;}    public myclass()   {       //imported class null @ point, nothing can done here.   }    public void onimportssatisfied()    {      //importedclass set @ point.   } } 

about actions mef takes set imports; first calls constructor, sets properties, calls notification method.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -