internal AprArray(IEnumerable items, AprPool pool) { if (items == null) { throw new ArgumentNullException(nameof(items)); } if (pool == null) { throw new ArgumentNullException(nameof(pool)); } int nItems = 0; foreach (TManaged t in items) { if (ReferenceEquals(t, null)) { throw new ArgumentException(SharpSvnStrings.ItemInListIsNull, nameof(items)); } nItems++; } _marshaller = Activator.CreateInstance <TMarshaller>(); _pool = pool; _handle = apr_tables.apr_array_make(pool.Handle, nItems, _marshaller.ItemSize); foreach (TManaged t in items) { var ptr = apr_tables.apr_array_push(_handle); _marshaller.Write(t, ptr, pool); } }
internal AprArray(ICollection <TManaged> items, AprPool pool) { if (items == null) { throw new ArgumentNullException(nameof(items)); } if (pool == null) { throw new ArgumentNullException(nameof(pool)); } _marshaller = Activator.CreateInstance <TMarshaller>(); _pool = pool; _handle = apr_tables.apr_array_make(pool.Handle, items.Count, _marshaller.ItemSize); foreach (var t in items) { var ptr = apr_tables.apr_array_push(_handle); _marshaller.Write(t, ptr, pool); } }