/// <summary> /// Initialize a instance of the <see cref="ShellProperty{T}" /> class. /// </summary> /// <param name="shellObject"></param> /// <param name="formatId"></param> /// <param name="propId"></param> public ShellProperty(ShellObject shellObject, Guid formatId, UInt32 propId) { Contract.Requires <ArgumentNullException>(shellObject != null); this.PropertyKey = ShellPropertyKeyFactory.Create(formatId, propId); this.ShellObject = shellObject; this.AllowSetTruncatedValue = false; if (this.Description.ValueType != typeof(T)) { throw new InvalidOperationException( String.Format(ErrorMessages.ShellPropertyUnmatchValueType, typeof(T), this.Description.ValueType)); } }
/// <summary> /// Initialize a instance of the <see cref="ShellProperty{T}" /> class. /// </summary> /// <param name="shellObject"></param> /// <param name="canonicalName"></param> public ShellProperty(ShellObject shellObject, string canonicalName) { Contract.Requires <ArgumentNullException>(shellObject != null); Contract.Requires <ArgumentException>(!String.IsNullOrWhiteSpace(canonicalName)); this.PropertyKey = ShellPropertyKeyFactory.Create(canonicalName); this.ShellObject = shellObject; this.AllowSetTruncatedValue = false; if (this.Description.ValueType != typeof(T)) { throw new InvalidOperationException( String.Format(ErrorMessages.ShellPropertyUnmatchValueType, typeof(T), this.Description.ValueType)); } }