Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- PathGradientBrush.cs
- FixedSOMTable.cs
- HttpProfileGroupBase.cs
- SystemKeyConverter.cs
- ColorDialog.cs
- WindowsUpDown.cs
- XsltQilFactory.cs
- ExtensionDataObject.cs
- WebBrowsableAttribute.cs
- MsdtcClusterUtils.cs
- InvalidWMPVersionException.cs
- XmlSchemaImporter.cs
- InvalidWMPVersionException.cs
- FacetChecker.cs
- HttpStaticObjectsCollectionBase.cs
- CodeDOMUtility.cs
- XPathNavigatorReader.cs
- GeneralTransform3DGroup.cs
- PrePostDescendentsWalker.cs
- SmiMetaData.cs
- DelayDesigner.cs
- DataListItemCollection.cs
- SoapSchemaImporter.cs
- GridViewColumnHeaderAutomationPeer.cs
- RestHandlerFactory.cs
- HttpModuleActionCollection.cs
- ControlBindingsCollection.cs
- TagMapInfo.cs
- CompositeCollectionView.cs
- SqlExpander.cs
- PathFigureCollectionValueSerializer.cs
- DynamicMethod.cs
- InterleavedZipPartStream.cs
- SocketException.cs
- InstanceView.cs
- ListView.cs
- MarshalByRefObject.cs
- Selector.cs
- XmlSchemaRedefine.cs
- DataQuery.cs
- SubstitutionList.cs
- EndGetFileNameFromUserRequest.cs
- ConfigurationStrings.cs
- ScriptServiceAttribute.cs
- PageBreakRecord.cs
- TreeViewCancelEvent.cs
- ListMarkerSourceInfo.cs
- SafeMarshalContext.cs
- ScriptingWebServicesSectionGroup.cs
- CodeStatementCollection.cs
- QuaternionConverter.cs
- MetaModel.cs
- RoleService.cs
- PieceNameHelper.cs
- ContainerUIElement3D.cs
- ConsoleTraceListener.cs
- DiscoveryEndpointValidator.cs
- StylusPointPropertyInfo.cs
- DownloadProgressEventArgs.cs
- WindowsListViewItemStartMenu.cs
- PolyBezierSegment.cs
- VisualTarget.cs
- ToolStripOverflowButton.cs
- MatcherBuilder.cs
- TextEffectResolver.cs
- XmlSchemaObject.cs
- PropertyRef.cs
- ReferenceEqualityComparer.cs
- SafeUserTokenHandle.cs
- PackagingUtilities.cs
- RectangleF.cs
- FontNamesConverter.cs
- ServiceReference.cs
- HashRepartitionEnumerator.cs
- Classification.cs
- CardSpaceSelector.cs
- SerializationException.cs
- PieceDirectory.cs
- TextTreeUndoUnit.cs
- UpdateTracker.cs
- RectangleConverter.cs
- SortedList.cs
- MatrixUtil.cs
- ResXBuildProvider.cs
- DoubleLinkListEnumerator.cs
- TypeCollectionPropertyEditor.cs
- CommandManager.cs
- EntityReference.cs
- XmlComment.cs
- TypeUsage.cs
- AnnotationMap.cs
- CorrelationTokenTypeConvertor.cs
- PassportIdentity.cs
- ParallelTimeline.cs
- TreeNodeStyleCollection.cs
- CodeBinaryOperatorExpression.cs
- EntityContainerAssociationSet.cs
- StreamingContext.cs
- DoubleLinkListEnumerator.cs
- ResourceAttributes.cs