Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Collections / Generic / ICollection.cs / 1305376 / ICollection.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Interface: ICollection ** **[....] ** ** ** Purpose: Base interface for all generic collections. ** ** ===========================================================*/ namespace System.Collections.Generic { using System; using System.Runtime.CompilerServices; using System.Diagnostics.Contracts; // Base interface for all collections, defining enumerators, size, and // synchronization methods. // 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 IEnumerable and ICollection . [ContractClass(typeof(ICollectionContract<>))] [TypeDependencyAttribute("System.SZArrayHelper")] public interface ICollection : IEnumerable { // Number of items in the collections. int Count { get; } bool IsReadOnly { get; } void Add(T item); void Clear(); bool Contains(T item); // CopyTo copies a collection into an Array, starting at a particular // index into the array. // void CopyTo(T[] array, int arrayIndex); //void CopyTo(int sourceIndex, T[] destinationArray, int destinationIndex, int count); bool Remove(T item); } [ContractClassFor(typeof(ICollection<>))] internal class ICollectionContract : ICollection { int ICollection .Count { get { Contract.Ensures(Contract.Result () >= 0); return default(int); } } bool ICollection .IsReadOnly { get { return default(bool); } } void ICollection .Add(T item) { //Contract.Ensures(((ICollection )this).Count == Contract.OldValue(((ICollection )this).Count) + 1); // not threadsafe } void ICollection .Clear() { } bool ICollection .Contains(T item) { return default(bool); } void ICollection .CopyTo(T[] array, int arrayIndex) { } bool ICollection .Remove(T item) { return default(bool); } IEnumerator IEnumerable .GetEnumerator() { Contract.Ensures(Contract.Result >() != null); return default(IEnumerator ); } 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: ICollection ** ** [....] ** ** ** Purpose: Base interface for all generic collections. ** ** ===========================================================*/ namespace System.Collections.Generic { using System; using System.Runtime.CompilerServices; using System.Diagnostics.Contracts; // Base interface for all collections, defining enumerators, size, and // synchronization methods. // 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 IEnumerable and ICollection . [ContractClass(typeof(ICollectionContract<>))] [TypeDependencyAttribute("System.SZArrayHelper")] public interface ICollection : IEnumerable { // Number of items in the collections. int Count { get; } bool IsReadOnly { get; } void Add(T item); void Clear(); bool Contains(T item); // CopyTo copies a collection into an Array, starting at a particular // index into the array. // void CopyTo(T[] array, int arrayIndex); //void CopyTo(int sourceIndex, T[] destinationArray, int destinationIndex, int count); bool Remove(T item); } [ContractClassFor(typeof(ICollection<>))] internal class ICollectionContract : ICollection { int ICollection .Count { get { Contract.Ensures(Contract.Result () >= 0); return default(int); } } bool ICollection .IsReadOnly { get { return default(bool); } } void ICollection .Add(T item) { //Contract.Ensures(((ICollection )this).Count == Contract.OldValue(((ICollection )this).Count) + 1); // not threadsafe } void ICollection .Clear() { } bool ICollection .Contains(T item) { return default(bool); } void ICollection .CopyTo(T[] array, int arrayIndex) { } bool ICollection .Remove(T item) { return default(bool); } IEnumerator IEnumerable .GetEnumerator() { Contract.Ensures(Contract.Result >() != null); return default(IEnumerator ); } 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
- RegistrySecurity.cs
- DiagnosticEventProvider.cs
- ThreadStartException.cs
- Size.cs
- Pens.cs
- EntityCollection.cs
- ApplicationSecurityManager.cs
- DocumentSequenceHighlightLayer.cs
- ElementNotAvailableException.cs
- QualifiedCellIdBoolean.cs
- IImplicitResourceProvider.cs
- IPPacketInformation.cs
- ChildTable.cs
- ByteStreamGeometryContext.cs
- _SslState.cs
- DefaultPropertyAttribute.cs
- AutomationPatternInfo.cs
- X509Extension.cs
- RtfToken.cs
- Calendar.cs
- WinEventTracker.cs
- FixedSOMLineCollection.cs
- SafeNativeMethods.cs
- MeshGeometry3D.cs
- ConfigurationValue.cs
- XmlSchemaComplexContent.cs
- PositiveTimeSpanValidator.cs
- XmlCountingReader.cs
- CalculatedColumn.cs
- DBSchemaTable.cs
- storepermissionattribute.cs
- ConnectionStringsSection.cs
- DbConnectionPoolOptions.cs
- _Win32.cs
- SqlGenerator.cs
- ItemType.cs
- TypeSource.cs
- GetPageNumberCompletedEventArgs.cs
- XmlAnyAttributeAttribute.cs
- DataSysAttribute.cs
- PagesSection.cs
- ConvertTextFrag.cs
- DataGridViewHitTestInfo.cs
- NameValueConfigurationCollection.cs
- Int32Rect.cs
- PathFigure.cs
- Domain.cs
- AuthenticationSection.cs
- Schedule.cs
- XsdCachingReader.cs
- StatusBarItem.cs
- XmlNodeComparer.cs
- EmptyControlCollection.cs
- NoClickablePointException.cs
- NativeDirectoryServicesQueryAPIs.cs
- StringInfo.cs
- X509SecurityToken.cs
- DataKeyCollection.cs
- ImageSource.cs
- OneOfConst.cs
- GradientBrush.cs
- RemoteHelper.cs
- DecoderBestFitFallback.cs
- TripleDESCryptoServiceProvider.cs
- PagedDataSource.cs
- PointF.cs
- Converter.cs
- DiscoveryDocument.cs
- TextEditorParagraphs.cs
- PersonalizableTypeEntry.cs
- RuleProcessor.cs
- CollectionViewGroupInternal.cs
- ProfilePropertySettings.cs
- SemaphoreSecurity.cs
- SqlAggregateChecker.cs
- TextSimpleMarkerProperties.cs
- HashMembershipCondition.cs
- ISAPIWorkerRequest.cs
- UnsafeNativeMethods.cs
- ToolStripDropDownButton.cs
- MarkupCompiler.cs
- DBNull.cs
- StructureChangedEventArgs.cs
- IntellisenseTextBox.designer.cs
- GridViewDeletedEventArgs.cs
- DataGridViewComboBoxCell.cs
- ChtmlCommandAdapter.cs
- Menu.cs
- ActivityXRefPropertyEditor.cs
- ComponentChangedEvent.cs
- GridViewRow.cs
- OptimizedTemplateContent.cs
- PropertyConverter.cs
- SqlProviderServices.cs
- TypeConverters.cs
- DbDataReader.cs
- EventToken.cs
- ValidationSummary.cs
- MessageQueueConverter.cs
- ApplicationBuildProvider.cs