/// <summary> /// Initializes a new instance of the <see cref="SocketAsyncEventArgsWrapper" /> class. /// </summary> /// <param name="args">The <see cref="SocketAsyncEventArgs" /> instance containing the event data.</param> /// <exception cref="System.ArgumentNullException">args</exception> public SocketAsyncEventArgsWrapper(SocketAsyncEventArgs args) { if (args == null) { throw new ArgumentNullException("args"); } _args = args; Capacity = args.Count; BaseOffset = args.Offset; _transferSetMethod = args.GetType().GetProperty("BytesTransferred").GetSetMethod(true); }