Microsoft.Protocols.TestSuites.MS_OXCFXICS.REPLGUID_IDSET.Contains C# (CSharp) Method

Contains() public method

Indicates whether contains IDSET.
public Contains ( IDSET idset ) : bool
idset IDSET A REPLGUID_IDSET.
return bool
        public override bool Contains(IDSET idset)
        {
            REPLGUID_IDSET ridset = idset as REPLGUID_IDSET;
            if (this.idsetList == null
                || this.idsetList.Count == 0)
            {
                if (ridset != null)
                {
                    return false;
                }

                return true;
            }

            if (ridset != null)
            {
                foreach (REPLGUID_IDSETElement ele1 in ridset.idsetList)
                {
                    foreach (REPLGUID_IDSETElement ele2 in this.idsetList)
                    {
                        foreach (GLOBCNTRange rng1 in ele1.GLOBSET.GLOBCNTRangeList)
                        {
                            bool hasRange = false;
                            foreach (GLOBCNTRange rng2 in ele2.GLOBSET.GLOBCNTRangeList)
                            {
                                if (rng2.Contains(rng1))
                                {
                                    hasRange = true;
                                    break;
                                }
                            }

                            if (!hasRange)
                            {
                                return false;
                            }
                        }
                    }
                }
            }

            return true;
        }

Usage Example

        /// <summary>
        /// Indicate If IDSET is in dictionary.
        /// </summary>
        /// <param name="idset">IDSET value.</param>
        /// <param name="dict">IDSET dictionary.</param>
        /// <returns>IF id set is in it will return true.</returns>
        private bool HasSameCnset(REPLGUID_IDSET idset, Dictionary<int, REPLGUID_IDSET> dict)
        {
            if (!this.IsInDict(idset, dict))
            {
                return false;
            }
            else
            {
                foreach (REPLGUID_IDSET ids in dict.Values)
                {
                    if (ids.Contains(idset) && idset.Contains(ids))
                    {
                        return true;
                    }
                }
            }

            return false;
        }