GSF.PQDIF.Logical.ObservationRecord.Remove C# (CSharp) Method

Remove() public method

Removes the given channel instance from the collection of channel instances.
public Remove ( ChannelInstance channelInstance ) : void
channelInstance ChannelInstance The channel instance to be removed.
return void
        public void Remove(ChannelInstance channelInstance)
        {
            CollectionElement channelInstancesElement = m_physicalRecord.Body.Collection.GetCollectionByTag(ChannelInstancesTag);
            List<CollectionElement> channelInstanceElements;
            ChannelInstance instance;

            if ((object)channelInstancesElement == null)
                return;

            channelInstanceElements = channelInstancesElement.GetElementsByTag(OneChannelInstanceTag).Cast<CollectionElement>().ToList();

            foreach (CollectionElement channelSettingElement in channelInstanceElements)
            {
                instance = new ChannelInstance(channelSettingElement, this);

                if (Equals(channelInstance, instance))
                    channelInstancesElement.RemoveElement(channelSettingElement);
            }
        }