Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / HttpFileCollection.cs / 1 / HttpFileCollection.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
/*
* Collection of posted files for the request intrinsic
*
* Copyright (c) 1998 Microsoft Corporation
*/
namespace System.Web {
using System.Runtime.InteropServices;
using System.Collections;
using System.Collections.Specialized;
using System.Security.Permissions;
using System.Web.Util;
///
///
/// Accesses incoming files uploaded by a client (using
/// multipart MIME and the Http Content-Type of multipart/formdata).
///
///
[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
public sealed class HttpFileCollection : NameObjectCollectionBase {
// cached All[] arrays
private HttpPostedFile[] _all;
private String[] _allKeys;
internal HttpFileCollection() : base(Misc.CaseInsensitiveInvariantKeyComparer) {
}
///
/// [To be supplied.]
///
public void CopyTo(Array dest, int index) {
if (_all == null) {
int n = Count;
_all = new HttpPostedFile[n];
for (int i = 0; i < n; i++)
_all[i] = Get(i);
}
if (_all != null) {
_all.CopyTo(dest, index);
}
}
internal void AddFile(String key, HttpPostedFile file) {
_all = null;
_allKeys = null;
BaseAdd(key, file);
}
#if UNUSED
internal void Reset() {
_all = null;
_allKeys = null;
BaseClear();
}
#endif
//
// Access by name
//
///
///
/// Returns a file from
/// the collection by file name.
///
///
public HttpPostedFile Get(String name) {
return(HttpPostedFile)BaseGet(name);
}
///
/// Returns item value from collection.
///
public HttpPostedFile this[String name]
{
get { return Get(name);}
}
//
// Indexed access
//
///
///
/// Returns a file from
/// the file collection by index.
///
///
public HttpPostedFile Get(int index) {
return(HttpPostedFile)BaseGet(index);
}
///
///
/// Returns key name from collection.
///
///
public String GetKey(int index) {
return BaseGetKey(index);
}
///
///
/// Returns an
/// item from the collection.
///
///
public HttpPostedFile this[int index]
{
get { return Get(index);}
}
//
// Access to keys and values as arrays
//
///
///
/// Creates an
/// array of keys in the collection.
///
///
public String[] AllKeys {
get {
if (_allKeys == null)
_allKeys = BaseGetAllKeys();
return _allKeys;
}
}
}
}
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ACE.cs
- ReadOnlyDataSourceView.cs
- DrawListViewColumnHeaderEventArgs.cs
- ConfigXmlSignificantWhitespace.cs
- CreateUserWizardDesigner.cs
- CacheOutputQuery.cs
- AnnotationAuthorChangedEventArgs.cs
- BuildProviderUtils.cs
- TextParagraphCache.cs
- KeyEventArgs.cs
- CompositeDataBoundControl.cs
- CodeRegionDirective.cs
- propertytag.cs
- ImageMetadata.cs
- CodeDirectionExpression.cs
- TdsParser.cs
- WebPageTraceListener.cs
- StructuredTypeEmitter.cs
- DbParameterCollectionHelper.cs
- FileVersion.cs
- DBProviderConfigurationHandler.cs
- DefaultPropertyAttribute.cs
- ParserExtension.cs
- DbConnectionStringCommon.cs
- StorageFunctionMapping.cs
- RootNamespaceAttribute.cs
- DataGridItem.cs
- HandlerWithFactory.cs
- ValidationEventArgs.cs
- ThreadAbortException.cs
- Exceptions.cs
- DeferredElementTreeState.cs
- SqlDataRecord.cs
- MouseButton.cs
- MetricEntry.cs
- NavigationEventArgs.cs
- ExtendedPropertyCollection.cs
- Debug.cs
- MobileCategoryAttribute.cs
- SmiGettersStream.cs
- Memoizer.cs
- XmlParserContext.cs
- MultiPageTextView.cs
- ProcessManager.cs
- FileUtil.cs
- SspiNegotiationTokenProviderState.cs
- CompensatableSequenceActivity.cs
- ReadOnlyPropertyMetadata.cs
- DataRowExtensions.cs
- DataServiceConfiguration.cs
- ExtractedStateEntry.cs
- ComponentGuaranteesAttribute.cs
- ControlIdConverter.cs
- CompensationParticipant.cs
- HttpListenerPrefixCollection.cs
- SimpleFieldTemplateUserControl.cs
- TreeBuilderBamlTranslator.cs
- Journal.cs
- MsmqAuthenticationMode.cs
- TheQuery.cs
- TableProviderWrapper.cs
- TransformPatternIdentifiers.cs
- StringFreezingAttribute.cs
- RangeValidator.cs
- XPathDescendantIterator.cs
- HttpCacheParams.cs
- ContentValidator.cs
- ServiceModelConfigurationSection.cs
- DataGridBoundColumn.cs
- ReferencedCollectionType.cs
- ApplicationTrust.cs
- Char.cs
- TypeListConverter.cs
- FormatException.cs
- EventListener.cs
- ObjectParameterCollection.cs
- SQLByte.cs
- QueryResult.cs
- PeerEndPoint.cs
- RequestQueue.cs
- Empty.cs
- DrawingGroup.cs
- KeyValueInternalCollection.cs
- TraceXPathNavigator.cs
- DetailsViewCommandEventArgs.cs
- TextEncodedRawTextWriter.cs
- DesignTimeParseData.cs
- Int16.cs
- EventHandlingScope.cs
- AcceptorSessionSymmetricTransportSecurityProtocol.cs
- ErrorStyle.cs
- ControlPaint.cs
- TableLayoutSettings.cs
- tabpagecollectioneditor.cs
- querybuilder.cs
- WhitespaceRuleLookup.cs
- isolationinterop.cs
- SafeFileMappingHandle.cs
- DeferredTextReference.cs
- SqlDependencyListener.cs