Search Results for

    Show / Hide Table of Contents

    Class WorksheetsCollection

    Class for managing the collection of WorkSheet elements.

    Inheritance
    System.Object
    WorksheetsCollection
    Implements
    System.Collections.Generic.IList<WorkSheet>
    System.Collections.Generic.ICollection<WorkSheet>
    System.Collections.Generic.IEnumerable<WorkSheet>
    System.Collections.IEnumerable
    Namespace: IronXL
    Assembly: IronXL.dll
    Syntax
    public class WorksheetsCollection : Object, IList<WorkSheet>, ICollection<WorkSheet>, IEnumerable<WorkSheet>, IEnumerable

    Properties

    Count

    Gets the number of elements contained in the collection.

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

    The count of worksheets.

    IsReadOnly

    Gets a value indicating whether the collection is read-only.

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

    Item[Int32]

    Gets or sets the WorkSheet at the specified index.

    Declaration
    public WorkSheet this[int index] { get; set; }
    Parameters
    Type Name Description
    System.Int32 index

    The index.

    Property Value
    Type Description
    WorkSheet

    The WorkSheet.

    Methods

    Add(WorkSheet)

    Adds an object to the end of the collection.

    Declaration
    public void Add(WorkSheet item)
    Parameters
    Type Name Description
    WorkSheet item

    The object to be added to the end of the collection.

    Clear()

    Delete all worksheets in the list.

    Declaration
    public void Clear()

    Contains(WorkSheet)

    Determines whether worksheets collection contains the element.

    Declaration
    public bool Contains(WorkSheet item)
    Parameters
    Type Name Description
    WorkSheet item

    The element to find.

    Returns
    Type Description
    System.Boolean

    true if contains the specified item otherwise, false.

    CopyTo(WorkSheet[], Int32)

    Copies the entire collection to a compatible one-dimensional array, starting at the specified index of the target array.

    Declaration
    public void CopyTo(WorkSheet[] array, int arrayIndex)
    Parameters
    Type Name Description
    WorkSheet[] array

    The destination of the elements copied from collection. The array must have zero-based indexing.

    System.Int32 arrayIndex

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

    Create(String)

    Create new worksheet with the specified name.

    Declaration
    public WorkSheet Create(string name)
    Parameters
    Type Name Description
    System.String name

    The name of the new worksheet.

    Returns
    Type Description
    WorkSheet

    A new WorkSheet within the workbook.

    FindIndex(Predicate<WorkSheet>)

    Searches for an element that matches the conditions defined by the specified predicate.

    Declaration
    public int FindIndex(Predicate<WorkSheet> predicate)
    Parameters
    Type Name Description
    System.Predicate<WorkSheet> predicate

    The predicate delegate that defines the conditions of the element to search for.

    Returns
    Type Description
    System.Int32

    The zero-based index of the first occurrence of an element that matches the conditions defined by predicate, if found; otherwise, –1.

    GetEnumerator()

    Returns an enumerator that iterates through the collection.

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

    An enumerator that can be used to iterate through the collection.

    IndexOf(WorkSheet)

    Searches for the specified object and returns the zero-based index of the first occurrence within the entire collection.

    Declaration
    public int IndexOf(WorkSheet item)
    Parameters
    Type Name Description
    WorkSheet item

    The object to locate in the collection.

    Returns
    Type Description
    System.Int32

    The zero-based index of the first occurrence of item within the entire collection, if found; otherwise, –1.

    Insert(Int32, WorkSheet)

    Inserts an element into the collection at the specified index.

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

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

    WorkSheet item

    The object to insert.

    Remove(WorkSheet)

    Removes the specified WorkSheet item.

    Declaration
    public bool Remove(WorkSheet item)
    Parameters
    Type Name Description
    WorkSheet item

    The item to remove.

    Returns
    Type Description
    System.Boolean

    true if item was successfully removed otherwise false.

    RemoveAt(Int32)

    Removes the element at the specified index of collection.

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

    The zero-based index of the element to remove.

    SetSheetIndex(WorkSheet, Int32)

    Sets the order of appearance for a given sheet.

    Declaration
    public void SetSheetIndex(WorkSheet sheet, int index)
    Parameters
    Type Name Description
    WorkSheet sheet

    The sheet to reorder.

    System.Int32 index

    The index to insert into.

    Implements

    System.Collections.Generic.IList<>
    System.Collections.Generic.ICollection<>
    System.Collections.Generic.IEnumerable<>
    System.Collections.IEnumerable
    ☀
    ☾
    Downloads
    • Download with Nuget
    • Start for Free
    In This Article
    Back to top
    Install with Nuget
    Want to deploy IronXL to a live project for FREE?
    What’s included?
    30 days of fully-functional product
    Test and share in a live environment
    No watermarks in production
    Get your free 30-day Trial Key instantly.
    No credit card or account creation required
    Your Trial License Key has been emailed to you.
    Download IronXL free to apply
    your Trial Licenses Key
    Install with NuGet View Licenses
    Licenses from $499. Have a question? Get in touch.