Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Extensions / UI / WebControls / LinqDataSourceHelper.cs / 1305376 / 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
- DeflateStream.cs
- CodeVariableReferenceExpression.cs
- KerberosReceiverSecurityToken.cs
- FileDialogPermission.cs
- AppDomainShutdownMonitor.cs
- ProgressChangedEventArgs.cs
- AnnotationDocumentPaginator.cs
- SR.cs
- InvalidateEvent.cs
- ImpersonateTokenRef.cs
- HScrollProperties.cs
- XmlSchemaAnnotation.cs
- RtfFormatStack.cs
- PrimitiveXmlSerializers.cs
- LinkButton.cs
- DataObjectPastingEventArgs.cs
- PointConverter.cs
- SqlConnectionHelper.cs
- XmlSerializerAssemblyAttribute.cs
- SoapHeaderException.cs
- SupportingTokenParameters.cs
- MsmqInputChannelBase.cs
- TokenBasedSet.cs
- FormViewModeEventArgs.cs
- HttpRuntime.cs
- InvalidateEvent.cs
- DiffuseMaterial.cs
- ColorMatrix.cs
- UndirectedGraph.cs
- GenericIdentity.cs
- RevocationPoint.cs
- OdbcCommandBuilder.cs
- GcHandle.cs
- Completion.cs
- PolyBezierSegment.cs
- ServiceOperationParameter.cs
- PersonalizationDictionary.cs
- ProtectedProviderSettings.cs
- DelegateSerializationHolder.cs
- SessionEndedEventArgs.cs
- _ContextAwareResult.cs
- Composition.cs
- ObjectDataSourceMethodEventArgs.cs
- BinarySerializer.cs
- XmlSchemaSimpleTypeList.cs
- RMEnrollmentPage2.cs
- ConstructorBuilder.cs
- WorkItem.cs
- IdentitySection.cs
- InertiaTranslationBehavior.cs
- TableLayoutStyle.cs
- DataGridViewCellLinkedList.cs
- LineInfo.cs
- WindowsTab.cs
- WindowShowOrOpenTracker.cs
- HtmlPageAdapter.cs
- SingleConverter.cs
- DesignerExtenders.cs
- TimelineGroup.cs
- ContextMenu.cs
- Point.cs
- OpacityConverter.cs
- TimeSpan.cs
- RSAOAEPKeyExchangeFormatter.cs
- Mouse.cs
- GlyphsSerializer.cs
- InboundActivityHelper.cs
- SvcMapFile.cs
- ListManagerBindingsCollection.cs
- DesignerTextBoxAdapter.cs
- NumericUpDownAccelerationCollection.cs
- PageClientProxyGenerator.cs
- PerspectiveCamera.cs
- Menu.cs
- CryptoSession.cs
- validation.cs
- AnchoredBlock.cs
- XmlResolver.cs
- DataSvcMapFileSerializer.cs
- MatrixTransform3D.cs
- TextPointer.cs
- NetNamedPipeBindingCollectionElement.cs
- MaterializeFromAtom.cs
- Listbox.cs
- RuntimeVariableList.cs
- xml.cs
- PrimitiveXmlSerializers.cs
- WindowsNonControl.cs
- StrokeNodeEnumerator.cs
- WebServiceMethodData.cs
- CodeIdentifiers.cs
- LockingPersistenceProvider.cs
- ImageAutomationPeer.cs
- basevalidator.cs
- GeometryCollection.cs
- ScriptingRoleServiceSection.cs
- DrawingImage.cs
- CallbackValidator.cs
- ImageSource.cs
- ListSortDescriptionCollection.cs