internal static T GetAt <T>(IVector <T> _this, uint index) { try { return(_this.GetAt(index)); } catch (Exception ex) { if (-2147483637 == ex._HResult) { throw new ArgumentOutOfRangeException("index"); } throw; } }
// Helpers: internal static T GetAt <T>(IVector <T> _this, uint index) { try { return(_this.GetAt(index)); // We delegate bounds checking to the underlying collection and if it detected a fault, // we translate it to the right exception: } catch (Exception ex) { if (HResults.E_BOUNDS == ex._HResult) { throw new ArgumentOutOfRangeException(nameof(index)); } throw; } }