packages/Windows API Code Pack 1.1/source/WindowsAPICodePack/Shell/PropertySystem/ShellPropertyWriter.cs
/// <summary>
/// Writes the specified property given the canonical name and a value. To allow truncation of the given value, set allowTruncatedValue
/// to true.
/// </summary>
/// <param name="canonicalName">The canonical name.</param>
/// <param name="value">The property value.</param>
/// <param name="allowTruncatedValue">True to allow truncation (default); otherwise False.</param>
/// <exception cref="System.ArgumentException">If the given canonical name is not valid.</exception>
Writes the specified property given the canonical name and a value. To allow truncation of the given value, set allowTruncatedValue
to true.
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)
        {
            PropertyKey propKey;
            int result = PropertySystemNativeMethods.PSGetPropertyKeyFromName(canonicalName, out propKey);
            if (!CoreErrorHelper.Succeeded(result))
            {
                throw new ArgumentException(
                    LocalizedMessages.ShellInvalidCanonicalName,
                    Marshal.GetExceptionForHR(result));
            }
            WriteProperty(propKey, value, allowTruncatedValue);
        }
public void WriteProperty ( string canonicalName , object value , bool allowTruncatedValue ) { PropertyKey propKey ; int result = PropertySystemNativeMethods . PSGetPropertyKeyFromName ( canonicalName , out propKey ) ; if ( ! CoreErrorHelper . Succeeded ( result ) ) { throw new ArgumentException ( LocalizedMessages . ShellInvalidCanonicalName , Marshal . GetExceptionForHR ( result ) ) ; } WriteProperty ( propKey , value , allowTruncatedValue ) ; }
Writes the specified property given the canonical name and a value.
Writes the specified property given the canonical name and a value .
// Get the PropertyKey using the canonicalName passed in
If the given canonical name is not valid.
If the given canonical name is not valid .
canonicalName
string
The canonical name.
The canonical name .
value
object
The property value.
The property value .
allowTruncatedValue
bool
True to allow truncation (default); otherwise False.
True to allow truncation ( default ) ; otherwise False .