Class ShellObjectCollection
- Namespace
- Microsoft.WindowsAPICodePack.Shell
- Assembly
- Microsoft.WindowsAPICodePack.Shell.dll
An ennumerable list of ShellObjects
public class ShellObjectCollection : IDisposable, IList<ShellObject>, ICollection<ShellObject>, IEnumerable<ShellObject>, IEnumerable
- Inheritance
-
ShellObjectCollection
- Implements
- Inherited Members
Constructors
ShellObjectCollection()
Constructs an empty ShellObjectCollection
public ShellObjectCollection()
Properties
Count
Item count
public int Count { get; }
Property Value
IsReadOnly
If true, the contents of the collection are immutable.
public bool IsReadOnly { get; }
Property Value
this[int]
The collection indexer
public ShellObject this[int index] { get; set; }
Parameters
index
intThe index of the item to retrieve.
Property Value
- ShellObject
The ShellObject at the specified index
Methods
Add(ShellObject)
Adds a ShellObject to the collection,
public void Add(ShellObject item)
Parameters
item
ShellObjectThe ShellObject to add.
BuildShellIDList()
Builds the data for the CFSTR_SHELLIDLIST Drag and Clipboard data format from the ShellObjects in the collection.
public MemoryStream BuildShellIDList()
Returns
- MemoryStream
A memory stream containing the drag/drop data.
Clear()
Clears the collection of ShellObjects.
public void Clear()
Contains(ShellObject)
Determines if the collection contains a particular ShellObject.
public bool Contains(ShellObject item)
Parameters
item
ShellObjectThe ShellObject.
Returns
- bool
true, if the ShellObject is in the list, false otherwise.
CopyTo(ShellObject[], int)
Copies the ShellObjects in the collection to a ShellObject array.
public void CopyTo(ShellObject[] array, int arrayIndex)
Parameters
array
ShellObject[]The destination to copy to.
arrayIndex
intThe index into the array at which copying will commence.
Dispose()
Standard Dispose pattern
public void Dispose()
Dispose(bool)
Standard Dispose patterns
protected virtual void Dispose(bool disposing)
Parameters
disposing
boolIndicates that this is being called from Dispose(), rather than the finalizer.
~ShellObjectCollection()
Finalizer
protected ~ShellObjectCollection()
FromDataObject(IDataObject)
Creates a ShellObjectCollection from an IDataObject passed during Drop operation.
public static ShellObjectCollection FromDataObject(IDataObject dataObject)
Parameters
dataObject
IDataObjectAn object that implements the IDataObject COM interface.
Returns
- ShellObjectCollection
ShellObjectCollection created from the given IDataObject
GetEnumerator()
Collection enumeration
public IEnumerator GetEnumerator()
Returns
IndexOf(ShellObject)
Returns the index of a particualr shell object in the collection
public int IndexOf(ShellObject item)
Parameters
item
ShellObjectThe item to search for.
Returns
- int
The index of the item found, or -1 if not found.
Insert(int, ShellObject)
Inserts a new shell object into the collection.
public void Insert(int index, ShellObject item)
Parameters
index
intThe index at which to insert.
item
ShellObjectThe item to insert.
Remove(ShellObject)
Removes a particular ShellObject from the list.
public bool Remove(ShellObject item)
Parameters
item
ShellObjectThe ShellObject to remove.
Returns
- bool
True if the item could be removed, false otherwise.
RemoveAt(int)
Removes the specified ShellObject from the collection
public void RemoveAt(int index)
Parameters
index
intThe index to remove at.