|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Com.WickedByte.Collections.Generic
{
/// <summary>
/// A generic read only list.
/// </summary>
/// <typeparam name="T">Type of data contained
/// in the list.</typeparam>
internal class ReadOnlyList<T>
: ReadOnlyCollection<T>, IList<T>
{
#region Private
private readonly IList<T> list;
#endregion
#region IList<T> Members
public int IndexOf( T item )
{
return list.IndexOf( item );
}
public void Insert( int index, T item )
{
throw new ReadOnlyException();
}
public void RemoveAt( int index )
{
throw new ReadOnlyException();
}
public T this[int index]
{
get
{
return list[index];
}
set
{
throw new ReadOnlyException();
}
}
#endregion
#region IEnumerable Members
public new System.Collections.IEnumerator GetEnumerator()
{
return list.GetEnumerator();
}
#endregion
/// <summary>
/// Creates a new instance of a <see cref="ReadOnlyList"/>
/// </summary>
/// <param name="list">The mutable list that will
/// be wrapped.</param>
public ReadOnlyList( IList<T> list )
: base( list )
{
this.list = list;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Marshall's torrid relationship with programming started as a child using BASIC on a Commodore PET computer in the 70's. He continued programming through high school, but did not study Computer Science in college. At the time, compilers would fail without telling you why, so after much soul searching, he realized he didn't want to make a living by spending eight hours a day looking for a missing semi-colon.
By the time he was pursuing his Ph.D. in Communication and Marketing, Microsoft had released Visual Studio. The improvements in the IDE were enough to cause Marshall to have late night affairs with COM and ASP. Marshall spent the dotcom bubble years as a web developer. After the bubble burst, he worked independently as a Java developer for medical applications. When Microsoft released an early beta of the .NET Framework, he was convinced to switch his focus from the Java Platform to the new Framework. He spent some time at Philips Medical Systems writing the data-access layer for the Carevue Chart hospital system. He is currently Technical Director for ASE Technologies.
Marshall lives in Salem, Massachusetts but would rather be in Hawaii.