public ParallelLoopResult Microsoft() => Parallel.For(0, Count, _ => { MyResource res = null; string str; try { res = _microsoftObjectPool.Get(); str = res.Value; } finally { if (res != null) { _microsoftObjectPool.Return(res); } } });
public string Microsoft() { MyResource res = null; string str; try { res = _microsoftObjectPool.Get(); str = res.Value; } finally { if (res != null) { _microsoftObjectPool.Return(res); } } return(str); }