WebExtensionPropertyCollection.RemoveAt

WebExtensionPropertyCollection.RemoveAt method

Remove the property by the name.

public void RemoveAt(string name)
ParameterTypeDescription
nameStringThe name of the property.

Examples

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

    public class WebExtensionPropertyCollectionMethodRemoveAtWithStringDemo
    {
        public static void Run()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];

            // Create a web extension property collection
            WebExtensionPropertyCollection properties = new WebExtensionPropertyCollection();

            // Add some properties to the collection
            properties.Add("Property1", "Value1");
            properties.Add("Property2", "Value2");
            properties.Add("Property3", "Value3");

            try
            {
                // Call the RemoveAt method with string parameter
                properties.RemoveAt("Property2");

                Console.WriteLine("Property with name 'Property2' removed successfully.");
                
                // Display remaining properties
                Console.WriteLine("Remaining properties:");
                for (int i = 0; i < properties.Count; i++)
                {
                    Console.WriteLine($"{properties[i].Name}: {properties[i].Value}");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error executing RemoveAt method: {ex.Message}");
            }
            
            // Save the workbook
            workbook.Save("WebExtensionPropertyCollectionDemo.xlsx");
        }
    }
}

See Also