/// <summary>
 /// Call the Function. Will only work once. Calling this twice will result in a exception
 /// </summary>
 public TRresult Call()
 {
     lock (me) {
         me = null;
         return(a());
     }
 }
        /// <summary>
        /// Returns a new Call once Function that can be reset using the returned Action
        /// </summary>
        public static Tuple <CallOnceFunction <TRresult>, Action> CreateWithReset(Func <TRresult> call)
        {
            var r = new CallOnceFunction <TRresult>(call);

            return(new Tuple <CallOnceFunction <TRresult>, Action>(r, () => r.me = r));
        }
 /// <summary>
 /// Creates a new CallOnceFunction
 /// </summary>
 /// <param name="call">Function that should only be called once</param>
 public CallOnceFunction(Func <TRresult> call)
 {
     me = this;
     a  = call;
 }