예제 #1
0
        public Csp Union(Csp policy2)
        {
            // This method tries to keep the ordering of directives
            // consistent with the inputs as much as possible, which
            // is why it's not using a dictionary for lookup.
            var directives = Directives
                             .ToList();

            foreach (var directive in policy2.Directives)
            {
                var matchingIndex = directives.FindIndex(d => d.Name == directive.Name);
                if (matchingIndex >= 0)
                {
                    directives[matchingIndex] = directives[matchingIndex].Union(directive);
                }
                else
                {
                    directives.Add(directive);
                }
            }

            return(new Csp(directives));
        }
예제 #2
0
 protected bool Equals(Csp other)
 {
     return(Directives.SequenceEqual(other.Directives));
 }