コード例 #1
0
        public void ListBoxSelectedIndexCollection_IListAdd_Invoke_ThrowsNotSupportedException(object value)
        {
            using var owner = new ListBox();
            IList collection = new ListBox.SelectedIndexCollection(owner);

            Assert.Throws <NotSupportedException>(() => collection.Add(value));
        }
コード例 #2
0
        internal static void AddRange([NotNull] this ListBox.SelectedIndexCollection indexCollection, [NotNull] IEnumerable <int> indices)
        {
            if (indexCollection == null)
            {
                throw new ArgumentNullException("indexCollection");
            }
            if (indices == null)
            {
                throw new ArgumentNullException("indices");
            }

            foreach (var index in indices)
            {
                indexCollection.Add(index);
            }
        }