Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Collections / Generic / IEnumerable.cs / 1305376 / IEnumerable.cs
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
/*============================================================
**
** Interface: IEnumerable
**
** [....]
**
**
** Purpose: Interface for providing generic IEnumerators
**
**
===========================================================*/
namespace System.Collections.Generic {
using System;
using System.Collections;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Diagnostics.Contracts;
// Implement this interface if you need to support foreach semantics.
// Note that T[] : IList, and we want to ensure that if you use
// IList, we ensure a YourValueType[] can be used
// without jitting. Hence the TypeDependencyAttribute on SZArrayHelper.
// This is a special hack internally though - see VM\compile.cpp.
// The same attribute is on IList and ICollection.
[TypeDependencyAttribute("System.SZArrayHelper")]
[ContractClass(typeof(IEnumerableContract<>))]
#if FEATURE_CORECLR
public interface IEnumerable : IEnumerable
#if false
{
}
#endif
#else
public interface IEnumerable : IEnumerable
#endif
{
// Returns an IEnumerator for this enumerable Object. The enumerator provides
// a simple way to access all the contents of a collection.
///
new IEnumerator GetEnumerator();
}
[ContractClassFor(typeof(IEnumerable<>))]
internal class IEnumerableContract : System.Collections.IEnumerableContract, IEnumerable
{
[Pure]
IEnumerator IEnumerable.GetEnumerator()
{
Contract.Ensures(Contract.Result>() != null);
return default(IEnumerator);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
/*============================================================
**
** Interface: IEnumerable
**
** [....]
**
**
** Purpose: Interface for providing generic IEnumerators
**
**
===========================================================*/
namespace System.Collections.Generic {
using System;
using System.Collections;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Diagnostics.Contracts;
// Implement this interface if you need to support foreach semantics.
// Note that T[] : IList, and we want to ensure that if you use
// IList, we ensure a YourValueType[] can be used
// without jitting. Hence the TypeDependencyAttribute on SZArrayHelper.
// This is a special hack internally though - see VM\compile.cpp.
// The same attribute is on IList and ICollection.
[TypeDependencyAttribute("System.SZArrayHelper")]
[ContractClass(typeof(IEnumerableContract<>))]
#if FEATURE_CORECLR
public interface IEnumerable : IEnumerable
#if false
{
}
#endif
#else
public interface IEnumerable : IEnumerable
#endif
{
// Returns an IEnumerator for this enumerable Object. The enumerator provides
// a simple way to access all the contents of a collection.
///
new IEnumerator GetEnumerator();
}
[ContractClassFor(typeof(IEnumerable<>))]
internal class IEnumerableContract : System.Collections.IEnumerableContract, IEnumerable
{
[Pure]
IEnumerator IEnumerable.GetEnumerator()
{
Contract.Ensures(Contract.Result>() != null);
return default(IEnumerator);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DetailsViewUpdatedEventArgs.cs
- PersonalizationEntry.cs
- OAVariantLib.cs
- SpeakProgressEventArgs.cs
- HwndSubclass.cs
- ValidatorUtils.cs
- PersonalizationState.cs
- Timeline.cs
- AdornedElementPlaceholder.cs
- XmlNamedNodeMap.cs
- SelectionPattern.cs
- SerializationFieldInfo.cs
- HtmlEmptyTagControlBuilder.cs
- CompareValidator.cs
- _Events.cs
- unitconverter.cs
- BaseTypeViewSchema.cs
- LocalIdKeyIdentifierClause.cs
- ApplicationBuildProvider.cs
- bindurihelper.cs
- ThreadStartException.cs
- XmlSerializableWriter.cs
- RotateTransform3D.cs
- ToolStripContainerActionList.cs
- TemplateControl.cs
- GroupQuery.cs
- XhtmlConformanceSection.cs
- ButtonFieldBase.cs
- CapabilitiesAssignment.cs
- PermissionListSet.cs
- wmiprovider.cs
- Automation.cs
- AddInBase.cs
- SocketAddress.cs
- DataBoundLiteralControl.cs
- StateWorkerRequest.cs
- PropertyPanel.cs
- AnonymousIdentificationModule.cs
- DataList.cs
- XmlPreloadedResolver.cs
- NavigationWindow.cs
- MenuItem.cs
- SwitchCase.cs
- StringBlob.cs
- ServiceChannelProxy.cs
- StateBag.cs
- ListBoxItemAutomationPeer.cs
- HttpException.cs
- VBCodeProvider.cs
- DataGridViewRowCollection.cs
- StorageEntityContainerMapping.cs
- QueryableDataSource.cs
- MetadataCache.cs
- DesigntimeLicenseContextSerializer.cs
- FormsIdentity.cs
- BuildProvidersCompiler.cs
- MinimizableAttributeTypeConverter.cs
- CryptoApi.cs
- XmlIlTypeHelper.cs
- VersionedStreamOwner.cs
- RegexNode.cs
- CodeMemberProperty.cs
- Separator.cs
- LassoHelper.cs
- HtmlControlPersistable.cs
- FixUpCollection.cs
- AuthorizationSection.cs
- MessageProtectionOrder.cs
- TrackingServices.cs
- InkCollectionBehavior.cs
- DataSourceXmlAttributeAttribute.cs
- NetworkInformationException.cs
- ConfigurationProperty.cs
- StyleBamlTreeBuilder.cs
- Parameter.cs
- ExpressionBuilderContext.cs
- SafeCoTaskMem.cs
- MaterialGroup.cs
- DecimalStorage.cs
- DoubleLinkList.cs
- ParseNumbers.cs
- Debug.cs
- SequenceDesigner.cs
- XNodeValidator.cs
- FlowDocumentFormatter.cs
- BaseCollection.cs
- RenderData.cs
- PatternMatcher.cs
- EnumBuilder.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- Registry.cs
- DefaultPrintController.cs
- XmlCharCheckingReader.cs
- XmlReaderSettings.cs
- ContentDefinition.cs
- Block.cs
- PageParser.cs
- ColumnHeader.cs
- RadialGradientBrush.cs
- DtrList.cs