itinero / reminiscence

A library for cross-platform memory mapping.
MIT License
9 stars 6 forks source link

Add IEnumerable to arrays. #20

Open xivk opened 4 years ago

xivk commented 4 years ago

Add IEnumerable to arrays. We can do this by just adding it to the array base class.

juliusfriedman commented 4 years ago

Is this the ask? Or did you want a special enumerator class that did something else?

in https://github.com/itinero/reminiscence/blob/develop/src/Reminiscence/Arrays/ArrayBase.cs

        /// <summary>
        /// Implements <see cref="IEnumerable{T}"/>
        /// </summary>
        /// <returns></returns>
        public IEnumerator<T> GetEnumerator()
        {
            for (long i = 0; i < Length; ++i)
                yield return this[i];
        }

        /// <summary>
        /// Implements <see cref="IEnumerable"/>
        /// </summary>
        /// <returns></returns>
        IEnumerator IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }

Perhaps also some unit tests?

juliusfriedman commented 4 years ago

https://github.com/itinero/reminiscence/pull/21

juliusfriedman commented 4 years ago

I think this issue can be closed unless you needed something else for this to be completed. Just LMK