Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- HtmlTableCell.cs
- WebPartTransformer.cs
- DecoderFallbackWithFailureFlag.cs
- OrderedDictionary.cs
- DataGridViewTextBoxCell.cs
- ErrorProvider.cs
- AssemblyBuilder.cs
- OracleInternalConnection.cs
- RegisteredScript.cs
- LocatorBase.cs
- ManifestResourceInfo.cs
- ValidationErrorInfo.cs
- PenLineJoinValidation.cs
- AssemblySettingAttributes.cs
- FileDialog.cs
- recordstate.cs
- TypeUtil.cs
- ColumnMapCopier.cs
- StateMachineDesignerPaint.cs
- ExpressionBuilderContext.cs
- RelatedPropertyManager.cs
- StructuralObject.cs
- FixedSOMTextRun.cs
- SafeLibraryHandle.cs
- ProgressBar.cs
- PeerTransportCredentialType.cs
- DataMember.cs
- WebBrowserProgressChangedEventHandler.cs
- TypeLoadException.cs
- ModelProperty.cs
- StackBuilderSink.cs
- EdgeModeValidation.cs
- ServiceAuthorizationManager.cs
- ColorContextHelper.cs
- PagesSection.cs
- TextServicesProperty.cs
- BamlRecordReader.cs
- DifferencingCollection.cs
- FileDataSourceCache.cs
- RtType.cs
- ServiceHttpHandlerFactory.cs
- URI.cs
- EntitySetBase.cs
- DependencyPropertyAttribute.cs
- XmlSchemaAll.cs
- DataGridViewRowHeaderCell.cs
- RMEnrollmentPage3.cs
- Geometry3D.cs
- PageCatalogPartDesigner.cs
- DataError.cs
- PaginationProgressEventArgs.cs
- EncoderReplacementFallback.cs
- DisableDpiAwarenessAttribute.cs
- QilExpression.cs
- MenuItemAutomationPeer.cs
- ParserStreamGeometryContext.cs
- SettingsAttributes.cs
- ControlPaint.cs
- NameValueConfigurationElement.cs
- StrongTypingException.cs
- SequenceQuery.cs
- EntityDesignerBuildProvider.cs
- WeakEventTable.cs
- XmlSchemaSimpleContentRestriction.cs
- XmlSchemaSequence.cs
- WindowVisualStateTracker.cs
- QueryStoreStatusRequest.cs
- Int32Collection.cs
- SourceElementsCollection.cs
- MsmqAppDomainProtocolHandler.cs
- Permission.cs
- ColorMatrix.cs
- TrustSection.cs
- StylusPointDescription.cs
- StatusBarDrawItemEvent.cs
- DashStyle.cs
- CompositeScriptReference.cs
- InkCanvas.cs
- IUnknownConstantAttribute.cs
- SimpleBitVector32.cs
- MatrixConverter.cs
- Rectangle.cs
- ResizeGrip.cs
- ObjectListSelectEventArgs.cs
- Buffer.cs
- PropertyGridEditorPart.cs
- XmlSchemaImport.cs
- SQLSingle.cs
- safemediahandle.cs
- CustomSignedXml.cs
- DbConnectionPool.cs
- SecurityResources.cs
- DocumentXPathNavigator.cs
- EventProviderWriter.cs
- TableLayoutPanel.cs
- SendKeys.cs
- HandoffBehavior.cs
- SqlConnectionPoolGroupProviderInfo.cs
- DefaultValueConverter.cs
- CalendarTable.cs