public void GetItem(int index, out T result) { if (_HasList) { Items.DangerousGetItem(index, out result); } else { switch (index) { case 0: result = Item1; return; case 1: result = Item2; return; case 2: result = Item3; return; case 3: result = Item4; return; default: throw new IndexOutOfRangeException(); } } }
private void RunPendingDraws() { lock (PendingDrawQueue) if (PendingDrawQueue.Count == 0) { return; } int i = 0; BatchGroup bg = null; while (true) { PendingDraw pd; lock (PendingDrawQueue) { if (PendingDrawQueue.Count == 0) { return; } pd = PendingDrawQueue.DangerousGetItem(0); PendingDrawQueue.DangerousRemoveAt(0); } ExceptionDispatchInfo excInfo = null; try { if (!AutoRenderTarget.IsRenderTargetValid(pd.RenderTarget)) { throw new Exception("Render target for pending draw was disposed between queue and prepare"); } if (!DoSynchronousDrawToRenderTarget(pd.RenderTarget, pd.Materials, pd.Handler, pd.UserData, ref pd.ViewTransform, "Pending Draw")) { throw new Exception("Unknown failure performing pending draw"); } } catch (Exception exc) { excInfo = ExceptionDispatchInfo.Capture(exc); } // throw new Exception("Unexpected error performing pending draw"); if (pd.OnComplete != null) { lock (CompletedPendingDrawQueue) CompletedPendingDrawQueue.Add(new CompletedPendingDraw { UserData = pd.UserData, Exception = excInfo, OnComplete = pd.OnComplete, RenderTarget = pd.RenderTarget }); } else if (excInfo != null) { } else { } } }
public TValue GetValue(Id id) { return(ValuesById.DangerousGetItem(id)); }