I have this piece of code:
FieldInfo fi = this.GetType().GetField(StringConstants.UNDERSCORE + phase, BindingFlags.Instance | BindingFlags.NonPublic);
    if (fi != null)
    {
        itemPhase = fi.GetValue(this) as IItemPhase;
    }
    if (itemPhase != null) 
    {
        _currentPhase = phase;
        _itemVo.Phase = phase;
        itemPhase.PreparePhase();
    }
FieldInfo fi gets correct value, so the field was found.
But FieldInfo.GetValue returns always null:
... and the Type matches:
Anyone knows why?
 
Aucun commentaire:
Enregistrer un commentaire