// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.ObjectModel;
namespace ICSharpCode.AvalonEdit.Utils
{
///
/// A collection that cannot contain null values.
///
[Serializable]
public class NullSafeCollection : Collection where T : class
{
///
protected override void InsertItem(int index, T item)
{
if (item == null)
throw new ArgumentNullException("item");
base.InsertItem(index, item);
}
///
protected override void SetItem(int index, T item)
{
if (item == null)
throw new ArgumentNullException("item");
base.SetItem(index, item);
}
}
}