System.Security.PermissionSet.GetEnumerator C# (CSharp) Method

GetEnumerator() public method

public GetEnumerator ( ) : IEnumerator
return IEnumerator
        public IEnumerator GetEnumerator() { return Array.Empty<object>().GetEnumerator(); }
        public override int GetHashCode() => base.GetHashCode();

Same methods

PermissionSet::GetEnumerator ( ) : System.Collections.IEnumerator

Usage Example

Beispiel #1
0
        // Form the union of this security set and another.
        public virtual PermissionSet Union(PermissionSet other)
        {
            PermissionSet pset;

            if (other == null)
            {
                pset = new PermissionSet(state);
            }
            else if (IsUnrestricted() || other.IsUnrestricted())
            {
                pset = new PermissionSet(PermissionState.Unrestricted);
            }
            else
            {
                pset = new PermissionSet(PermissionState.None);
            }
            foreach (IPermission perm in permissions)
            {
                pset.AddPermission(perm);
            }
            if (other == null || other.IsEmpty())
            {
                return(pset);
            }
            IEnumerator e = other.GetEnumerator();
            IPermission permOther, permThis;
            int         index;

            while (e.MoveNext())
            {
                permOther = (e.Current as IPermission);
                if (permOther != null)
                {
                    index = pset.FindPermission(permOther.GetType());
                    if (index != -1)
                    {
                        permThis = (IPermission)(permissions[index]);
                        permThis = permThis.Union(permOther);
                        if (permThis != null)
                        {
                            pset.SetPermission(permThis);
                        }
                    }
                    else
                    {
                        pset.AddPermission(permOther);
                    }
                }
            }
            return(pset);
        }
All Usage Examples Of System.Security.PermissionSet::GetEnumerator