Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / xsp / System / Web / Extensions / ui / webcontrols / LinqDataSourceHelper.cs / 1 / LinqDataSourceHelper.cs
namespace System.Web.UI.WebControls { using System.Collections; using System.Collections.Generic; internal class LinqDataSourceHelper { public static bool EnumerableContentEquals(IEnumerable enumerableA, IEnumerable enumerableB) { IEnumerator enumeratorA = enumerableA.GetEnumerator(); IEnumerator enumeratorB = enumerableB.GetEnumerator(); while (enumeratorA.MoveNext()) { if (!enumeratorB.MoveNext()) return false; object itemA = enumeratorA.Current; object itemB = enumeratorB.Current; if (itemA == null) { if (itemB != null) return false; } else if (!itemA.Equals(itemB)) return false; } if (enumeratorB.MoveNext()) return false; return true; } public static Type FindGenericEnumerableType(Type type) { // Logic taken from Queryable.AsQueryable which accounts for Array types which are not // generic but implement the generic IEnumerable interface. while ((type != null) && (type != typeof(object)) && (type != typeof(string))) { if (type.IsGenericType && (type.GetGenericTypeDefinition() == typeof(IEnumerable<>))) { return type; } foreach (Type interfaceType in type.GetInterfaces()) { Type genericInterface = FindGenericEnumerableType(interfaceType); if (genericInterface != null) { return genericInterface; } } type = type.BaseType; } return null; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. namespace System.Web.UI.WebControls { using System.Collections; using System.Collections.Generic; internal class LinqDataSourceHelper { public static bool EnumerableContentEquals(IEnumerable enumerableA, IEnumerable enumerableB) { IEnumerator enumeratorA = enumerableA.GetEnumerator(); IEnumerator enumeratorB = enumerableB.GetEnumerator(); while (enumeratorA.MoveNext()) { if (!enumeratorB.MoveNext()) return false; object itemA = enumeratorA.Current; object itemB = enumeratorB.Current; if (itemA == null) { if (itemB != null) return false; } else if (!itemA.Equals(itemB)) return false; } if (enumeratorB.MoveNext()) return false; return true; } public static Type FindGenericEnumerableType(Type type) { // Logic taken from Queryable.AsQueryable which accounts for Array types which are not // generic but implement the generic IEnumerable interface. while ((type != null) && (type != typeof(object)) && (type != typeof(string))) { if (type.IsGenericType && (type.GetGenericTypeDefinition() == typeof(IEnumerable<>))) { return type; } foreach (Type interfaceType in type.GetInterfaces()) { Type genericInterface = FindGenericEnumerableType(interfaceType); if (genericInterface != null) { return genericInterface; } } type = type.BaseType; } return null; } } } // 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
- VirtualDirectoryMapping.cs
- TextTreeUndoUnit.cs
- PreApplicationStartMethodAttribute.cs
- Attributes.cs
- BrowserTree.cs
- MetadataException.cs
- ActivityTypeDesigner.xaml.cs
- TextCollapsingProperties.cs
- DateTimeFormat.cs
- XmlComment.cs
- RemoteWebConfigurationHost.cs
- XmlDocumentType.cs
- UInt64.cs
- WmpBitmapEncoder.cs
- Serializer.cs
- OleServicesContext.cs
- X509UI.cs
- NetNamedPipeSecurityElement.cs
- HttpHandlerAction.cs
- ObjectDataProvider.cs
- FragmentQueryKB.cs
- LoginName.cs
- CookieProtection.cs
- AppDomainFactory.cs
- ErrorFormatter.cs
- SqlTriggerContext.cs
- PocoPropertyAccessorStrategy.cs
- FillErrorEventArgs.cs
- OracleInternalConnection.cs
- AbstractDataSvcMapFileLoader.cs
- PipelineModuleStepContainer.cs
- AdapterDictionary.cs
- DecoderFallback.cs
- RelationshipSet.cs
- ThicknessAnimation.cs
- StylusPointCollection.cs
- AnnotationMap.cs
- XmlnsCache.cs
- RightNameExpirationInfoPair.cs
- MenuItemStyle.cs
- MsmqIntegrationAppDomainProtocolHandler.cs
- ListBox.cs
- OneOf.cs
- XmlNode.cs
- WsiProfilesElementCollection.cs
- SqlMethodAttribute.cs
- ErrorWrapper.cs
- MonthChangedEventArgs.cs
- MembershipPasswordException.cs
- DeclarativeCatalogPart.cs
- ActivityCodeDomSerializationManager.cs
- ReflectTypeDescriptionProvider.cs
- Vector3DKeyFrameCollection.cs
- ExclusiveTcpTransportManager.cs
- SrgsElementFactory.cs
- Container.cs
- TextParaClient.cs
- DynamicValueConverter.cs
- WaveHeader.cs
- SHA1CryptoServiceProvider.cs
- HtmlInputReset.cs
- EventLogReader.cs
- AppSettingsReader.cs
- ComAdminInterfaces.cs
- SecurityManager.cs
- MeasureItemEvent.cs
- Size3D.cs
- RoleService.cs
- DesignerRegion.cs
- DesignerAdapterUtil.cs
- EventWaitHandle.cs
- PlaceHolder.cs
- XmlArrayItemAttribute.cs
- X509CertificateClaimSet.cs
- EntityDataSourceUtil.cs
- UICuesEvent.cs
- DataGridPreparingCellForEditEventArgs.cs
- XmlNodeChangedEventArgs.cs
- RSAPKCS1SignatureDeformatter.cs
- TrackingLocationCollection.cs
- QueryValue.cs
- LayoutManager.cs
- Model3DGroup.cs
- ColumnHeaderConverter.cs
- StringAnimationUsingKeyFrames.cs
- AppModelKnownContentFactory.cs
- CatalogPartChrome.cs
- CreationContext.cs
- BookmarkEventArgs.cs
- AccessText.cs
- XmlSchemaImport.cs
- InkCanvasSelection.cs
- EncodingInfo.cs
- AtomMaterializerLog.cs
- XmlHelper.cs
- SqlDataRecord.cs
- FontWeightConverter.cs
- XmlDataSourceView.cs
- VBIdentifierTrimConverter.cs
- XpsImage.cs