Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / 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;
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
//
// 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;
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PolyBezierSegment.cs
- DPCustomTypeDescriptor.cs
- RubberbandSelector.cs
- ProtocolsSection.cs
- SettingsPropertyValueCollection.cs
- BaseTemplatedMobileComponentEditor.cs
- MapPathBasedVirtualPathProvider.cs
- TypeUnloadedException.cs
- SystemDropShadowChrome.cs
- Container.cs
- ItemCheckedEvent.cs
- Expressions.cs
- DocumentReference.cs
- InitializationEventAttribute.cs
- StopStoryboard.cs
- WinEventQueueItem.cs
- SQLBinaryStorage.cs
- CodeStatement.cs
- DurableErrorHandler.cs
- OptimalBreakSession.cs
- CompilerError.cs
- Vector3DValueSerializer.cs
- TTSEvent.cs
- ExtensionQuery.cs
- Pair.cs
- RayHitTestParameters.cs
- SafeNativeMethodsOther.cs
- DataComponentGenerator.cs
- MarshalDirectiveException.cs
- BindingValueChangedEventArgs.cs
- BulletChrome.cs
- StringValueSerializer.cs
- oledbmetadatacollectionnames.cs
- BindingManagerDataErrorEventArgs.cs
- AuthenticateEventArgs.cs
- COAUTHIDENTITY.cs
- WsrmMessageInfo.cs
- Error.cs
- ListViewDataItem.cs
- XmlDocumentFragment.cs
- ByteStreamMessageEncoderFactory.cs
- PublishLicense.cs
- httpapplicationstate.cs
- SoapInteropTypes.cs
- PersistenceTask.cs
- CryptoApi.cs
- ToolboxItemFilterAttribute.cs
- EntityDataSourceContextDisposingEventArgs.cs
- RequestCache.cs
- XmlObjectSerializerWriteContextComplex.cs
- SafePEFileHandle.cs
- XslCompiledTransform.cs
- GeneralTransform2DTo3D.cs
- Clipboard.cs
- EngineSite.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- DecimalConstantAttribute.cs
- ParsedAttributeCollection.cs
- TemplateXamlParser.cs
- _ContextAwareResult.cs
- DbExpressionRules.cs
- SimpleWebHandlerParser.cs
- TextParagraphProperties.cs
- WCFBuildProvider.cs
- Utils.cs
- CallbackValidator.cs
- CqlParserHelpers.cs
- UserPreferenceChangedEventArgs.cs
- XamlDebuggerXmlReader.cs
- arclist.cs
- XPathNavigatorKeyComparer.cs
- SingleObjectCollection.cs
- GenericWebPart.cs
- ToolStripManager.cs
- SwitchLevelAttribute.cs
- ActivityDesignerAccessibleObject.cs
- ImageKeyConverter.cs
- TextMetrics.cs
- CurrentChangingEventManager.cs
- PostBackTrigger.cs
- RowUpdatedEventArgs.cs
- EntityFunctions.cs
- WebPartConnectionsDisconnectVerb.cs
- TextPenaltyModule.cs
- DirectoryGroupQuery.cs
- NonParentingControl.cs
- BitmapEffectOutputConnector.cs
- SoapSchemaMember.cs
- ListBoxItemWrapperAutomationPeer.cs
- WebPartCatalogAddVerb.cs
- InteropExecutor.cs
- TemplateBindingExpression.cs
- OracleString.cs
- WorkflowOwnerAsyncResult.cs
- BasicExpandProvider.cs
- ACL.cs
- AlgoModule.cs
- TypeHelper.cs
- ObjectItemAttributeAssemblyLoader.cs
- BooleanProjectedSlot.cs