ReadOnlyCollectionBaseT Class

Represents a read-only collection of objects.
Inheritance Hierarchy
SystemObject
  Aspose.TasksReadOnlyCollectionBaseT
    Aspose.TasksVbaModuleAttributeCollection
    Aspose.TasksVbaModuleCollection
    Aspose.TasksVbaReferenceCollection

Namespace:  Aspose.Tasks
Assembly:  Aspose.Tasks (in Aspose.Tasks.dll) Version: 21.10
Syntax
public abstract class ReadOnlyCollectionBase<T> : IList<T>, 
	ICollection<T>, IEnumerable<T>, IEnumerable

Type Parameters

T
Type of collection items.

The ReadOnlyCollectionBaseT type exposes the following members.

Properties
  NameDescription
Public propertyCode exampleCount
Gets the number of objects contained in the object.
Public propertyItem
Returns the element at the specified index.
Methods
  NameDescription
Public methodAdd
This is the stub implementation of ICollection's Add method, that only throws NotSupportedException
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodCode exampleGetEnumerator
Returns an enumerator for this collection.
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodCode exampleToList
Converts the collection object to a list of VbaModule objects.
Public methodToString (Inherited from Object.)
Examples
Shows how to iterate over VBA modules.
var project = new Project(DataDir + "VbaProject.mpp");
var vbaProject = project.VbaProject;

Console.WriteLine("Total Modules Count: " + vbaProject.Modules.Count);
foreach (var module in vbaProject.Modules)
{
    Console.WriteLine("Module Name: " + module.Name);
    Console.WriteLine("Source Code: " + module.SourceCode);
    Console.WriteLine();
}

// the collection can be converted into a plain list
List<VbaModule> modules = vbaProject.Modules.ToList();
foreach (var unused in modules)
{
    // work with modules
}
See Also