Class ConnectionParameterCollection

ConnectionParameterCollection class

Specifies the ConnectionParameter collection

public class ConnectionParameterCollection : CollectionBase<ConnectionParameter>

Properties

NameDescription
Capacity { get; set; }
Count { get; }
Item { get; set; }Gets the ConnectionParameter element at the specified index. (2 indexers)
Item { get; }Gets the ConnectionParameter element with the specified name.

Methods

NameDescription
BinarySearch(ConnectionParameter)
BinarySearch(ConnectionParameter, IComparer<ConnectionParameter>)
BinarySearch(int, int, ConnectionParameter, IComparer<ConnectionParameter>)
Clear()
Contains(ConnectionParameter)
CopyTo(ConnectionParameter[])
CopyTo(ConnectionParameter[], int)
CopyTo(int, ConnectionParameter[], int, int)
Exists(Predicate<ConnectionParameter>)
Find(Predicate<ConnectionParameter>)
FindAll(Predicate<ConnectionParameter>)
FindIndex(Predicate<ConnectionParameter>)
FindIndex(int, Predicate<ConnectionParameter>)
FindIndex(int, int, Predicate<ConnectionParameter>)
FindLast(Predicate<ConnectionParameter>)
FindLastIndex(Predicate<ConnectionParameter>)
FindLastIndex(int, Predicate<ConnectionParameter>)
FindLastIndex(int, int, Predicate<ConnectionParameter>)
GetEnumerator()
IndexOf(ConnectionParameter)
IndexOf(ConnectionParameter, int)
IndexOf(ConnectionParameter, int, int)
LastIndexOf(ConnectionParameter)
LastIndexOf(ConnectionParameter, int)
LastIndexOf(ConnectionParameter, int, int)
RemoveAt(int)

Examples

namespace AsposeCellsExamples
{
    using Aspose.Cells;
    using Aspose.Cells.ExternalConnections;
    using System;

    public class ExternalConnectionsClassConnectionParameterCollectionDemo
    {
        public static void Run()
        {
            // Create a new workbook for demonstration
            Workbook workbook = new Workbook();
            
            try
            {
                // Get the first external connection (will create one if none exists)
                ExternalConnection connection = workbook.DataConnections[0];
                
                // Get the parameters collection from the connection
                ConnectionParameterCollection parameters = connection.Parameters;
                
                // Demonstrate basic functionality by checking collection properties
                Console.WriteLine($"ConnectionParameterCollection count: {parameters.Count}");
                
                // Attempt to access an item (will be null if collection is empty)
                if (parameters.Count > 0)
                {
                    ConnectionParameter param = parameters[0];
                    Console.WriteLine(param == null ? "No parameters in collection" : "Parameter exists");
                }
                else
                {
                    Console.WriteLine("No parameters in collection");
                }
                
                // Save the workbook
                workbook.Save("ConnectionParameterCollectionDemo.xlsx");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error working with ConnectionParameterCollection: {ex.Message}");
            }
        }
    }
}

See Also