Best way of keeping track of components

What is better? This:

public classs Component : MonoBehavior {

   public AnotherComponent anotherComponent;

   void Start() {

      anotherComponent = GetComponent<AnotherComponent>();

   }

}

or this:

public classs Component : MonoBehavior {

   private AnotherComponent _anotherComponent;

   public AnotherComponent anotherComponent {

      get {

         if (_anotherComponent == null)
            _anotherComponent = GetComponent<AnotherComponent>();

         return _anotherComponent;

     }

  }

}

(I suppose that all components on an object are static.)

Well the second example is slower because every access to anotherComponent requires a null check, plus if the compiler didn’t inline the property get then you have the overhead of another indirection (it may well inline though). Given that the component is supposed to always exist it makes sense to do the configuration in Start as the amount of memory required to hold the variable is negligible.