File: System\Security\Cryptography\Pkcs\RecipientInfoEnumerator.cs
Web Access
Project: src\src\runtime\src\libraries\System.Security.Cryptography.Pkcs\src\System.Security.Cryptography.Pkcs.csproj (System.Security.Cryptography.Pkcs)
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Collections;
using System.Diagnostics;

namespace System.Security.Cryptography.Pkcs
{
    public sealed class RecipientInfoEnumerator : IEnumerator
    {
        internal RecipientInfoEnumerator(RecipientInfoCollection RecipientInfos)
        {
            _recipientInfos = RecipientInfos;
            _current = -1;
        }

        public RecipientInfo Current
        {
            get
            {
                return _recipientInfos[_current];
            }
        }

        object IEnumerator.Current
        {
            get
            {
                return _recipientInfos[_current];
            }
        }

        public bool MoveNext()
        {
            if (_current >= _recipientInfos.Count - 1)
            {
                return false;
            }
            _current++;
            return true;
        }

        public void Reset()
        {
            _current = -1;
        }

        private readonly RecipientInfoCollection _recipientInfos;
        private int _current;
    }
}