Пример #1
0
 /// <summary>
 /// Static create function (for use in LINQ queries, etc.)
 /// </summary>
 /// <param name="_collection0"></param>
 /// <param name="_collectionitem1"></param>
 /// <param name="_collectionitem2"></param>
 public static CollectionItem Create(Collection _collection0, CollectionItem _collectionitem1, CollectionItem _collectionitem2)
 {
     return(new CollectionItem(_collection0, _collectionitem1, _collectionitem2));
 }
Пример #2
0
        /// <summary>
        /// Public constructor with required data.
        /// </summary>
        /// <param name="_collection0"></param>
        /// <param name="_collectionitem1"></param>
        /// <param name="_collectionitem2"></param>
        public CollectionItem(Collection _collection0, CollectionItem _collectionitem1, CollectionItem _collectionitem2)
        {
            // NOTE: This class has one-to-one associations with CollectionItem.
            // One-to-one associations are not validated in constructors since this causes a scenario where each one must be constructed before the other.

            if (_collection0 == null)
            {
                throw new ArgumentNullException(nameof(_collection0));
            }

            _collection0.CollectionItem.Add(this);

            if (_collectionitem1 == null)
            {
                throw new ArgumentNullException(nameof(_collectionitem1));
            }

            _collectionitem1.Next = this;

            if (_collectionitem2 == null)
            {
                throw new ArgumentNullException(nameof(_collectionitem2));
            }

            _collectionitem2.Previous = this;

            Init();
        }