Table of Contents

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

ShellObject

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 bool

true 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 IShellProperty

The property name.

value object

The 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 IShellProperty

The property name.

value object

The property value.

allowTruncatedValue bool

True 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 PropertyKey

The property key.

value object

The 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 PropertyKey

The property key.

value object

The value associated with the key.

allowTruncatedValue bool

True 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

canonicalName string

The canonical name.

value object

The property value.

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 string

The canonical name.

value object

The property value.

allowTruncatedValue bool

True 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 T

The 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 T

The property value.

allowTruncatedValue bool

True to allow truncation (default); otherwise False.

Type Parameters

T

The type of the property name.