OlePropertySection Class
Definition
- Namespace
- Bodu.IO.Compound.PropertySets
- Assembly
- Bodu.IO.Compound.dll
- Package
- Bodu.IO.Compound 1.0.0
- Source
- OlePropertySection.cs
Represents a single section of an OLE property set - a format-identified group of properties keyed by property identifier (PID).
public sealed class OlePropertySection
- Inheritance
-
OlePropertySection
- Inherited Members
- Extension Methods
Remarks
A property set contains one or two sections. The first carries the well-known properties (such as summary information); an optional second, user-defined section carries custom properties whose human-readable names are held in the section's PropertyNames dictionary.
Constructors
OlePropertySection(Guid, int)
Initializes a new instance of the OlePropertySection class for authoring, with no properties.
public OlePropertySection(Guid formatId, int codePage)
Parameters
Properties
CodePage
Gets the code page used to decode ANSI (VT_LPSTR) strings in the section.
public int CodePage { get; }
Property Value
- int
The section code page;
1252when none is declared.
FormatId
Gets the format identifier (FMTID) of the section.
public Guid FormatId { get; }
Property Value
- Guid
The section's format identifier.
this[int]
Gets the value of the property with the specified identifier.
public OlePropertyValue? this[int propertyId] { get; }
Parameters
propertyIdintThe property identifier (PID).
Property Value
- OlePropertyValue
The property value, or null when no such property exists.
Properties
Gets the decoded properties keyed by property identifier.
public IReadOnlyDictionary<int, OlePropertyValue> Properties { get; }
Property Value
- IReadOnlyDictionary<int, OlePropertyValue>
A read-only dictionary of property identifier to value.
PropertyNames
Gets the property-name dictionary mapping property identifiers to human-readable names.
public IReadOnlyDictionary<int, string> PropertyNames { get; }
Property Value
- IReadOnlyDictionary<int, string>
A read-only dictionary populated from the section's dictionary property; empty when the section declares no names.
Methods
GetNamedProperties()
Builds a dictionary of the section's named properties, joining the property-name dictionary with the decoded values.
public IReadOnlyDictionary<string, OlePropertyValue> GetNamedProperties()
Returns
- IReadOnlyDictionary<string, OlePropertyValue>
A dictionary keyed by property name; only properties that have both a name and a value are included.
Remove(int)
Removes the property with the specified identifier.
public bool Remove(int propertyId)
Parameters
propertyIdintThe property identifier (PID).
Returns
Set(int, OlePropertyValue)
Sets the value of the property with the specified identifier.
public void Set(int propertyId, OlePropertyValue value)
Parameters
propertyIdintThe property identifier (PID).
valueOlePropertyValueThe value to assign.
Exceptions
- ArgumentNullException
Thrown when
valueis null.
SetName(int, string)
Assigns a human-readable name to a property identifier in this section's dictionary.
public void SetName(int propertyId, string name)
Parameters
Exceptions
- ArgumentNullException
Thrown when
nameis null.
TryGetValue(int, out OlePropertyValue)
Attempts to get the value of the property with the specified identifier.
public bool TryGetValue(int propertyId, out OlePropertyValue value)
Parameters
propertyIdintThe property identifier (PID).
valueOlePropertyValueWhen this method returns true, the property value; otherwise null.
Returns
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |