Class ShellPropertyWriter
- Namespace
- Microsoft.WindowsAPICodePack.Shell.PropertySystem
- Assembly
- Microsoft.WindowsAPICodePack.Shell.dll
Creates a property writer capable of setting multiple properties for a given ShellObject.
public class ShellPropertyWriter : IDisposable
- Inheritance
-
ShellPropertyWriter
- Implements
- Inherited Members
Properties
ParentShellObject
Reference to parent ShellObject (associated with this writer)
protected ShellObject ParentShellObject { get; }
Property Value
Methods
Close()
Call this method to commit the writes (calls to WriteProperty method) and dispose off the writer.
public void Close()
Dispose()
Release the native objects.
public void Dispose()
Dispose(bool)
Release the native and managed objects.
protected virtual void Dispose(bool disposing)
Parameters
disposing
booltrue to release both managed and unmanaged resources; false to release only unmanaged resources.
~ShellPropertyWriter()
protected ~ShellPropertyWriter()
WriteProperty(IShellProperty, object)
Writes the specified property using an IShellProperty and a value.
public void WriteProperty(IShellProperty shellProperty, object value)
Parameters
shellProperty
IShellPropertyThe property name.
value
objectThe property value.
WriteProperty(IShellProperty, object, bool)
Writes the specified property given an IShellProperty and a value. To allow truncation of the given value, set allowTruncatedValue to true.
public void WriteProperty(IShellProperty shellProperty, object value, bool allowTruncatedValue)
Parameters
shellProperty
IShellPropertyThe property name.
value
objectThe property value.
allowTruncatedValue
boolTrue to allow truncation (default); otherwise False.
WriteProperty(PropertyKey, object)
Writes the given property key and value.
public void WriteProperty(PropertyKey key, object value)
Parameters
key
PropertyKeyThe property key.
value
objectThe value associated with the key.
WriteProperty(PropertyKey, object, bool)
Writes the given property key and value. To allow truncation of the given value, set allowTruncatedValue to true.
public void WriteProperty(PropertyKey key, object value, bool allowTruncatedValue)
Parameters
key
PropertyKeyThe property key.
value
objectThe value associated with the key.
allowTruncatedValue
boolTrue to allow truncation (default); otherwise False.
Exceptions
- InvalidOperationException
If the writable property store is already closed.
- ArgumentOutOfRangeException
If AllowTruncatedValue is set to false and while setting the value on the property it had to be truncated in a string or rounded in a numeric value.
WriteProperty(string, object)
Writes the specified property given the canonical name and a value.
public void WriteProperty(string canonicalName, object value)
Parameters
WriteProperty(string, object, bool)
Writes the specified property given the canonical name and a value. To allow truncation of the given value, set allowTruncatedValue to true.
public void WriteProperty(string canonicalName, object value, bool allowTruncatedValue)
Parameters
canonicalName
stringThe canonical name.
value
objectThe property value.
allowTruncatedValue
boolTrue to allow truncation (default); otherwise False.
Exceptions
- ArgumentException
If the given canonical name is not valid.
WriteProperty<T>(ShellProperty<T>, T)
Writes the specified property using a strongly-typed ShellProperty and a value.
public void WriteProperty<T>(ShellProperty<T> shellProperty, T value)
Parameters
shellProperty
ShellProperty<T>The property name.
value
TThe property value.
Type Parameters
T
The type of the property name.
WriteProperty<T>(ShellProperty<T>, T, bool)
Writes the specified property given a strongly-typed ShellProperty and a value. To allow truncation of the given value, set allowTruncatedValue to true.
public void WriteProperty<T>(ShellProperty<T> shellProperty, T value, bool allowTruncatedValue)
Parameters
shellProperty
ShellProperty<T>The property name.
value
TThe property value.
allowTruncatedValue
boolTrue to allow truncation (default); otherwise False.
Type Parameters
T
The type of the property name.