Table of Contents

Class PostedFileCollection

Namespace
Dynamicweb.Environment
Assembly
Dynamicweb.Core.dll

Base implementation for abstraction of filecollection for posted files, as used in Dynamicweb.

public class PostedFileCollection : ICollection<PostedFileBase>, IEnumerable<PostedFileBase>, IEnumerable
Inheritance
PostedFileCollection
Implements
Inherited Members
Extension Methods

Constructors

PostedFileCollection()

Constructs a default collection using a list as backing data collection.

public PostedFileCollection()

Properties

AllKeys

Gets an array that contains the keys (names) of all posted file objects in the collection.

public virtual string[] AllKeys { get; }

Property Value

string[]

Collection

Backing data collection

protected virtual ICollection<PostedFileBase> Collection { get; }

Property Value

ICollection<PostedFileBase>

Count

Contains posted file objects.

public virtual int Count { get; }

Property Value

int

IsReadOnly

Gets a value indicating whether the collection is read-only.

public virtual bool IsReadOnly { get; }

Property Value

bool

this[string]

Gets the posted file object that has the specified name from the collection.

public virtual PostedFileBase? this[string name] { get; }

Parameters

name string

The name of the object to return.

Property Value

PostedFileBase

Methods

Add(PostedFileBase)

Adds an item to the collection

public virtual void Add(PostedFileBase item)

Parameters

item PostedFileBase

The file to add to the collection

Clear()

Removes all items from the collection

public virtual void Clear()

Contains(PostedFileBase)

Determines whether the collection contains a specific value.

public virtual bool Contains(PostedFileBase item)

Parameters

item PostedFileBase

The file to locate in the collection

Returns

bool

true if item is found in the collections; otherwise, false

CopyTo(PostedFileBase[], int)

Copies the elements of the collection to an array, starting at a particular array index.

public virtual void CopyTo(PostedFileBase[] array, int arrayIndex)

Parameters

array PostedFileBase[]

The one-dimensional array that is the destination of the elements copied from the collections. The array must have zero-based indexing

arrayIndex int

The zero-based index in array at which copying begins

GetEnumerator()

Returns an enumerator that iterates through the collection

public IEnumerator GetEnumerator()

Returns

IEnumerator

An enumerator that can be used to iterate through the collection

GetFile(string)

Returns the posted file object that has the specified name from the collection.

public virtual PostedFileBase? GetFile(string name)

Parameters

name string

The name of the object to return.

Returns

PostedFileBase

The posted file object that is specified by name.

GetFiles(string)

When implemented in a derived class, returns all files that match the specified name.

public virtual IList<PostedFileBase> GetFiles(string name)

Parameters

name string

The name to match.

Returns

IList<PostedFileBase>

The collection of files.

GetName(PostedFileBase)

Used to get the name of the file.

protected virtual string GetName(PostedFileBase file)

Parameters

file PostedFileBase

File to get name of

Returns

string

Name of file

Remarks

Can be overriden to change how files are matched to name in collection

Remove(PostedFileBase)

Removes the first occurrence of a specific object from the collection

public virtual bool Remove(PostedFileBase item)

Parameters

item PostedFileBase

The file to remove from the collection

Returns

bool

true if item was successfully removed from the collection; otherwise, false

To top