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

AddNewChannelInstance() public method

Adds a new channel instance to the collection of channel instances in this observation record.
public AddNewChannelInstance ( ) : ChannelInstance
return ChannelInstance
        public ChannelInstance AddNewChannelInstance()
        {
            CollectionElement channelInstancesElement = m_physicalRecord.Body.Collection.GetCollectionByTag(ChannelInstancesTag);
            CollectionElement channelInstanceElement = new CollectionElement() { TagOfElement = OneChannelInstanceTag };
            ChannelInstance channelInstance = new ChannelInstance(channelInstanceElement, this);

            if ((object)channelInstancesElement == null)
            {
                channelInstancesElement = new CollectionElement()
                {
                    TagOfElement = OneChannelInstanceTag
                };

                m_physicalRecord.Body.Collection.AddElement(channelInstancesElement);
            }

            channelInstancesElement.AddElement(channelInstanceElement);

            return channelInstance;
        }