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
- MapPathBasedVirtualPathProvider.cs
- SystemWebCachingSectionGroup.cs
- PropertyContainer.cs
- GregorianCalendarHelper.cs
- ForceCopyBuildProvider.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- WindowHelperService.cs
- TextSelectionProcessor.cs
- CharAnimationBase.cs
- MultipleViewProviderWrapper.cs
- UserControlAutomationPeer.cs
- LogicalCallContext.cs
- COM2FontConverter.cs
- ContextQuery.cs
- XpsInterleavingPolicy.cs
- GenericWebPart.cs
- GlyphRun.cs
- HMACSHA1.cs
- BindingExpressionUncommonField.cs
- BounceEase.cs
- RequestTimeoutManager.cs
- OleStrCAMarshaler.cs
- PropertyValueUIItem.cs
- XPathNavigatorKeyComparer.cs
- AutomationTextAttribute.cs
- ToolBarPanel.cs
- FormsAuthenticationEventArgs.cs
- XPathAncestorQuery.cs
- ActivityBindForm.Designer.cs
- IPPacketInformation.cs
- ConnectorEditor.cs
- SubpageParagraph.cs
- SystemEvents.cs
- XMLSyntaxException.cs
- SecurityState.cs
- baseaxisquery.cs
- Predicate.cs
- DataRowChangeEvent.cs
- Proxy.cs
- ValidationResult.cs
- XamlTypeMapper.cs
- MultipleViewProviderWrapper.cs
- DiscoveryDocumentSearchPattern.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- ManagementDateTime.cs
- DocumentXmlWriter.cs
- LinqToSqlWrapper.cs
- Vector3DKeyFrameCollection.cs
- MetadataPropertyCollection.cs
- HttpCachePolicyElement.cs
- DirectoryNotFoundException.cs
- PreservationFileReader.cs
- DbDataReader.cs
- ListViewDeletedEventArgs.cs
- BamlLocalizableResourceKey.cs
- KeyInterop.cs
- SessionChannels.cs
- DrawingState.cs
- securitycriticaldata.cs
- DrawingContextWalker.cs
- UnsafeNativeMethods.cs
- LineGeometry.cs
- WmfPlaceableFileHeader.cs
- AsymmetricSignatureFormatter.cs
- TableLayoutStyle.cs
- WebHttpSecurityModeHelper.cs
- NotifyInputEventArgs.cs
- SweepDirectionValidation.cs
- SpecialNameAttribute.cs
- ChangeInterceptorAttribute.cs
- PrincipalPermission.cs
- CodeTypeParameter.cs
- GeneralTransform.cs
- EmbeddedMailObjectsCollection.cs
- NamespaceQuery.cs
- exports.cs
- Line.cs
- ScopelessEnumAttribute.cs
- WebPartConnectionCollection.cs
- SafeNativeMethods.cs
- StorageEndPropertyMapping.cs
- LockRecoveryTask.cs
- SQLGuidStorage.cs
- SByte.cs
- D3DImage.cs
- embossbitmapeffect.cs
- SQLGuid.cs
- CalendarBlackoutDatesCollection.cs
- ServiceCredentialsElement.cs
- ToolTipService.cs
- GeneratedContractType.cs
- Keywords.cs
- DataObjectMethodAttribute.cs
- PrintPreviewDialog.cs
- RegexMatchCollection.cs
- XsltArgumentList.cs
- SessionSwitchEventArgs.cs
- DropShadowEffect.cs
- PoisonMessageException.cs
- TableLayoutStyle.cs