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
- EraserBehavior.cs
- XmlElementAttributes.cs
- ConsoleTraceListener.cs
- DataGridViewRowCancelEventArgs.cs
- ProxyGenerator.cs
- ping.cs
- MetadataArtifactLoaderCompositeResource.cs
- JsonFormatWriterGenerator.cs
- LayoutManager.cs
- UnicastIPAddressInformationCollection.cs
- XmlSchemaObject.cs
- LocalBuilder.cs
- BrowserCapabilitiesFactory.cs
- WebPartCloseVerb.cs
- SchemaImporterExtension.cs
- XmlConvert.cs
- WebPartZoneBase.cs
- XmlCDATASection.cs
- KeyboardDevice.cs
- RealizedColumnsBlock.cs
- TextClipboardData.cs
- DataServiceExpressionVisitor.cs
- WebPartDescriptionCollection.cs
- SecurityUniqueId.cs
- DataGridViewAutoSizeModeEventArgs.cs
- ApplySecurityAndSendAsyncResult.cs
- ProxyHwnd.cs
- NotifyParentPropertyAttribute.cs
- CellRelation.cs
- SimpleBitVector32.cs
- PointHitTestResult.cs
- DependencyPropertyChangedEventArgs.cs
- SecurityTokenSerializer.cs
- AutoResizedEvent.cs
- TextContainerHelper.cs
- TrustManagerMoreInformation.cs
- ResourceContainer.cs
- WebEncodingValidatorAttribute.cs
- OpenFileDialog.cs
- SystemEvents.cs
- OracleMonthSpan.cs
- QuaternionAnimationBase.cs
- IntegerValidator.cs
- DefaultValidator.cs
- EventInfo.cs
- DataBindingCollectionEditor.cs
- ActivationProxy.cs
- Accessible.cs
- Content.cs
- CustomError.cs
- ClientFormsAuthenticationMembershipProvider.cs
- TextShapeableCharacters.cs
- SecurityAccessDeniedException.cs
- AssemblyName.cs
- SafeMemoryMappedViewHandle.cs
- TypeUnloadedException.cs
- DataComponentNameHandler.cs
- TextDocumentView.cs
- CustomCategoryAttribute.cs
- FilteredAttributeCollection.cs
- SqlError.cs
- MSAAEventDispatcher.cs
- XmlSubtreeReader.cs
- GridSplitter.cs
- TranslateTransform.cs
- HttpValueCollection.cs
- PriorityRange.cs
- ClientSettingsStore.cs
- OperationParameterInfo.cs
- WinFormsUtils.cs
- CursorConverter.cs
- OperationResponse.cs
- ThicknessAnimationBase.cs
- ReadOnlyAttribute.cs
- DashStyles.cs
- NameValueConfigurationCollection.cs
- PropertyMappingExceptionEventArgs.cs
- PersonalizationStateQuery.cs
- Point3DAnimation.cs
- DoubleLinkListEnumerator.cs
- BoundColumn.cs
- IntSecurity.cs
- WebBrowserUriTypeConverter.cs
- DbRetry.cs
- TransportElement.cs
- SessionIDManager.cs
- GenerateHelper.cs
- LinkClickEvent.cs
- RolePrincipal.cs
- HttpModuleCollection.cs
- PackageStore.cs
- WebPartDisplayModeCancelEventArgs.cs
- X509ClientCertificateAuthenticationElement.cs
- QilInvokeLateBound.cs
- SessionIDManager.cs
- SafeNativeMethods.cs
- Switch.cs
- PermissionRequestEvidence.cs
- ContainerControl.cs
- SqlTrackingService.cs