コード例 #1
0
        /// <summary>
        ///     Get the display name of the specified display name type.
        /// </summary>
        /// <param name="displayNameType">Display name type.</param>
        /// <returns>Display name.</returns>
        /// <exception cref="ShellException">Failed to acquire display name.</exception>
        public string GetDisplayName(DisplayNameTypes displayNameType)
        {
            Contract.Ensures(Contract.Result <string>() != null);

            string result;
            var    hr = this.ShellItemInterface.GetDisplayName((SIGDN)displayNameType, out result);

            if (HRESULT.Failed(hr))
            {
                throw new ShellException(ErrorMessages.ShellItemCannotGetDisplayName, hr);
            }

            return(result);
        }
コード例 #2
0
 /// <summary>
 ///     Get the display name of the specified <paramref name="displayNameType" />.
 /// </summary>
 /// <param name="displayNameType">Display name type.</param>
 /// <returns>Display name.</returns>
 public virtual string GetDisplayName(DisplayNameTypes displayNameType)
 {
     Contract.Ensures(Contract.Result <string>() != null);
     return(this.ShellItem.GetDisplayName(displayNameType));
 }