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
- AuthorizationPolicyTypeElementCollection.cs
- MsmqIntegrationOutputChannel.cs
- HashCodeCombiner.cs
- InvariantComparer.cs
- XmlEncodedRawTextWriter.cs
- SchemaImporter.cs
- CollectionChangeEventArgs.cs
- LookupNode.cs
- DependencyPropertyConverter.cs
- DataKey.cs
- ParsedAttributeCollection.cs
- ListView.cs
- AccessDataSourceView.cs
- ListView.cs
- Enum.cs
- TextSchema.cs
- EditorPartCollection.cs
- mansign.cs
- VarRefManager.cs
- DaylightTime.cs
- PromptEventArgs.cs
- TextBoxBaseDesigner.cs
- LabelAutomationPeer.cs
- TypeDescriptor.cs
- AutomationIdentifier.cs
- TdsParserHelperClasses.cs
- ChannelSinkStacks.cs
- WsdlHelpGeneratorElement.cs
- XPathException.cs
- Geometry3D.cs
- SegmentInfo.cs
- URLMembershipCondition.cs
- DataGridParentRows.cs
- OptimisticConcurrencyException.cs
- SqlClientPermission.cs
- FocusTracker.cs
- MouseCaptureWithinProperty.cs
- XmlChildEnumerator.cs
- DispatchWrapper.cs
- NoResizeHandleGlyph.cs
- AudioDeviceOut.cs
- CompressedStack.cs
- ThreadInterruptedException.cs
- DesignerActionMethodItem.cs
- MouseEvent.cs
- XXXOnTypeBuilderInstantiation.cs
- MetadataItemCollectionFactory.cs
- UpdateTranslator.cs
- ElapsedEventArgs.cs
- CheckBoxList.cs
- SynthesizerStateChangedEventArgs.cs
- UpdatableWrapper.cs
- SelectionGlyphBase.cs
- QilValidationVisitor.cs
- MetabaseSettings.cs
- DataGridViewIntLinkedList.cs
- DesignerTextViewAdapter.cs
- Throw.cs
- EventDescriptor.cs
- TriggerBase.cs
- CatalogZone.cs
- DrawingAttributes.cs
- TextHidden.cs
- Char.cs
- InterleavedZipPartStream.cs
- ExpressionCopier.cs
- ValueExpressions.cs
- CurrentChangingEventArgs.cs
- QueryNode.cs
- TabItem.cs
- JavaScriptObjectDeserializer.cs
- ComplexLine.cs
- ContextBase.cs
- RC2CryptoServiceProvider.cs
- BinaryCommonClasses.cs
- ForeignKeyConstraint.cs
- StylusPointPropertyId.cs
- NegatedCellConstant.cs
- XmlSchemaDocumentation.cs
- DataControlLinkButton.cs
- FreezableOperations.cs
- DesignerForm.cs
- TraceContext.cs
- PassportAuthentication.cs
- TextParagraphCache.cs
- ActivityExecutorOperation.cs
- EdmValidator.cs
- RoleManagerModule.cs
- TableHeaderCell.cs
- OutputCacheProfile.cs
- RewritingProcessor.cs
- NotificationContext.cs
- AutoGeneratedFieldProperties.cs
- SiteMapSection.cs
- FormsIdentity.cs
- QueryContinueDragEvent.cs
- Section.cs
- ResourceDictionaryCollection.cs
- HtmlFormWrapper.cs
- AssociationTypeEmitter.cs