WorksheetCustomPropertyCollection Class
Collection of worksheet custom properties. Supported in XLSX only.
public sealed class WorksheetCustomPropertyCollection : IEnumerable<KeyValuePair<String, String>>, IEnumerable
Public NotInheritable Class WorksheetCustomPropertyCollection
Implements IEnumerable(Of KeyValuePair(Of String, String)), IEnumerable
- Inheritance:
- System.ObjectWorksheetCustomPropertyCollection
Implements
Properties
Count
Gets the number of custom properties in the collection.
Property Value
- System.Int32
Item[Int32]
Gets or sets a custom property value by zero-based index.
Parameters
index
- System.Int32
Property Value
- System.String
Exceptions
- System.ArgumentOutOfRangeException
If the given index is less than 0 or greater than or equal to Count.
Item[String]
Gets or sets a custom property value by name.
Parameters
name
- System.String
Property Value
- System.String
Exceptions
- System.ArgumentNullException
If name
is null
.
- System.ArgumentNullException
If value
is null
.
- System.Collections.Generic.KeyNotFoundException
If the given name was not present.
Methods
Add(String, String)
Adds a new custom property.
Parameters
name
- System.String
Custom property name.
value
- System.String
Custom property value.
Exceptions
- System.ArgumentNullException
If name
is null
.
- System.ArgumentNullException
If value
is null
.
Clear()
Removes all custom properties.
Contains(String)
Determines whether a custom property is in the collection.
Parameters
name
- System.String
Custom property name to locate in the collection.
Returns
- System.Boolean
true
if custom property is found; otherwise false
.
Exceptions
- System.ArgumentNullException
If name
is null
.
GetEnumerator()
Returns an enumerator for the collection.
public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
Public Function GetEnumerator As IEnumerator(Of KeyValuePair(Of String, String))
Returns
- System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<System.String, System.String>>
An enumerator for the collection.
Remove(String)
Removes a custom property by name.
Parameters
name
- System.String
Returns
- System.Boolean
true
if removed; otherwise false
.
Exceptions
- System.ArgumentNullException
If name
is null
.
RemoveAt(Int32)
Removes the custom property at the specified zero-based index.
Parameters
index
- System.Int32
Exceptions
- System.ArgumentOutOfRangeException
If the given index is less than 0 or greater than or equal to Count.
TryGetValue(String, out String)
Attempts to get the value of a custom property with the specified name.
public bool TryGetValue(string name, out string value)
Public Function TryGetValue(name As String, ByRef value As String) As Boolean
Parameters
name
- System.String
Custom property name to locate in the collection.
value
- System.String
Custom property value associated with the specified name, if the name is found; otherwise null
.
Returns
- System.Boolean
true
if the collection contains a custom property with the specified name; otherwise, false
.
Exceptions
- System.ArgumentNullException
If name
is null
.