/// <summary>
        /// Combines two IdLists.
        /// </summary>
        /// <param name="folderIdList">The folder identifier list.</param>
        /// <param name="folderItemIdList">The folder item identifier list.</param>
        /// <returns>A new, combined IdList.</returns>
        public static IdList Combine(IdList folderIdList, IdList folderItemIdList)
        {
            var combined = new List <ShellId>(folderIdList.Ids);

            combined.AddRange(folderItemIdList.Ids);
            return(IdList.Create(combined));
        }
 /// <summary>
 /// Gets the desktop idlist.
 /// </summary>
 /// <returns>The desktop idlist.</returns>
 public static IdList GetDesktop()
 {
     IntPtr pidl;
     Shell32.SHGetKnownFolderIDList(KnownFolders.FOLDERID_Desktop, KNOWN_FOLDER_FLAG.KF_NO_FLAGS, IntPtr.Zero,
         out pidl);
     var idlist = IdList.Create(Decode(pidl));
     Shell32.ILFree(pidl);
     return idlist;
 }
        /// <summary>
        /// Converts a Win32 PIDL to a <see cref="PidlManager"/> <see cref="IdList"/>.
        /// The PIDL is not freed by the PIDL manager, if it has been allocated by the
        /// shell it is the caller's responsibility to manage it.
        /// </summary>
        /// <param name="pidl">The pidl.</param>
        /// <returns>An <see cref="IdList"/> that corresponds to the PIDL.</returns>
        public static IdList PidlToIdlist(IntPtr pidl)
        {
            if(pidl == IntPtr.Zero)
                throw new Exception("Cannot create an ID list from a null pidl.");

            //  Create the raw ID list.
            var ids = Decode(pidl);

            //  Return a new idlist from the pidl.
            return IdList.Create(ids);
        }