November Happy Hour will be moved to Thursday December 5th.

Class ReadOnlyStringList

A read-only collection of string with case insensitive comparisons. The items are stored as upper invariant case.

Inheritance
System.Object
ReadOnlyStringList
Implements
System.Collections.Generic.IList<System.String>
System.Collections.Generic.ICollection<System.String>
System.Collections.Generic.IEnumerable<System.String>
System.Collections.IEnumerable
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Core
Assembly: EPiServer.dll
Version: 9.12.2
Syntax
public class ReadOnlyStringList : IList<string>, ICollection<string>, IEnumerable<string>, IEnumerable

Constructors

ReadOnlyStringList(IList<String>)

Initializes a new instance of the ReadOnlyStringList class.

Declaration
public ReadOnlyStringList(IList<string> items)
Parameters
Type Name Description
System.Collections.Generic.IList<System.String> items

The items.

Properties

Count

Gets the number of elements contained in the System.Collections.Generic.ICollection<T>.

Declaration
public int Count { get; }
Property Value
Type Description
System.Int32

IsReadOnly

Gets a value indicating whether the System.Collections.Generic.ICollection<T> is read-only.

Declaration
public bool IsReadOnly { get; }
Property Value
Type Description
System.Boolean

Item[Int32]

Gets or the System.String at the specified index. Set is not a valid operation on a readonly list. Will throw InvalidOperationException;

Declaration
public string this[int index] { get; set; }
Parameters
Type Name Description
System.Int32 index
Property Value
Type Description
System.String

Methods

Add(String)

Not a valid operation on a readonly list. Will throw InvalidOperationException;

Declaration
public void Add(string item)
Parameters
Type Name Description
System.String item

The object to add to the System.Collections.Generic.ICollection<T>.

Exceptions
Type Condition
System.NotSupportedException

The System.Collections.Generic.ICollection<T> is read-only.

Clear()

Not a valid operation on a readonly list. Will throw InvalidOperationException;

Declaration
public void Clear()
Exceptions
Type Condition
System.NotSupportedException

The System.Collections.Generic.ICollection<T> is read-only.

Contains(String)

Determines whether the System.Collections.Generic.ICollection<T> contains a specific value. The compairson will be performed on upper invariant case.

Declaration
public bool Contains(string item)
Parameters
Type Name Description
System.String item

The object to locate in the System.Collections.Generic.ICollection<T>.

Returns
Type Description
System.Boolean

true if item is found in the System.Collections.Generic.ICollection<T>; otherwise, false.

CopyTo(String[], Int32)

Copies the elements of the System.Collections.Generic.ICollection<T> to an System.Array, starting at a particular System.Array index.

Declaration
public void CopyTo(string[] array, int arrayIndex)
Parameters
Type Name Description
System.String[] array

The one-dimensional System.Array that is the destination of the elements copied from System.Collections.Generic.ICollection<T>. The System.Array must have zero-based indexing.

System.Int32 arrayIndex

The zero-based index in array at which copying begins.

Exceptions
Type Condition
System.ArgumentNullException

array is null.

System.ArgumentOutOfRangeException

arrayIndex is less than 0.

System.ArgumentException

array is multidimensional.-or-arrayIndex is equal to or greater than the length of array.-or-The number of elements in the source System.Collections.Generic.ICollection<T> is greater than the available space from arrayIndex to the end of the destination array.-or-Type cannot be cast automatically to the type of the destination array.

GetEnumerator()

Returns an enumerator that iterates through the collection.

Declaration
public IEnumerator<string> GetEnumerator()
Returns
Type Description
System.Collections.Generic.IEnumerator<System.String>

A System.Collections.Generic.IEnumerator<T> that can be used to iterate through the collection.

IndexOf(String)

Determines the index of a specific item in the System.Collections.Generic.IList<T>.

Declaration
public int IndexOf(string item)
Parameters
Type Name Description
System.String item

The object to locate in the System.Collections.Generic.IList<T>.

Returns
Type Description
System.Int32

The index of item if found in the list; otherwise, -1.

Insert(Int32, String)

Not a valid operation on a readonly list. Will throw InvalidOperationException;

Declaration
public void Insert(int index, string item)
Parameters
Type Name Description
System.Int32 index

The zero-based index at which item should be inserted.

System.String item

The object to insert into the System.Collections.Generic.IList<T>.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

index is not a valid index in the System.Collections.Generic.IList<T>.

System.NotSupportedException

The System.Collections.Generic.IList<T> is read-only.

Remove(String)

Not a valid operation on a readonly list. Will throw InvalidOperationException;

Declaration
public bool Remove(string item)
Parameters
Type Name Description
System.String item

The object to remove from the System.Collections.Generic.ICollection<T>.

Returns
Type Description
System.Boolean

true if item was successfully removed from the System.Collections.Generic.ICollection<T>; otherwise, false. This method also returns false if item is not found in the original System.Collections.Generic.ICollection<T>.

Exceptions
Type Condition
System.NotSupportedException

The System.Collections.Generic.ICollection<T> is read-only.

RemoveAt(Int32)

Not a valid operation on a readonly list. Will throw InvalidOperationException;

Declaration
public void RemoveAt(int index)
Parameters
Type Name Description
System.Int32 index

The zero-based index of the item to remove.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

index is not a valid index in the System.Collections.Generic.IList<T>.

System.NotSupportedException

The System.Collections.Generic.IList<T> is read-only.

Explicit Interface Implementations

IEnumerable.GetEnumerator()

Returns an enumerator that iterates through a collection.

Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type Description
System.Collections.IEnumerator

An System.Collections.IEnumerator object that can be used to iterate through the collection.

Implements

System.Collections.Generic.IList<T>
System.Collections.Generic.ICollection<T>
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable

Extension Methods