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
- DateTimeFormat.cs
- CompiledRegexRunner.cs
- ExpressionBuilder.cs
- DtdParser.cs
- WebPart.cs
- DeploymentSectionCache.cs
- SQLDecimal.cs
- ContentHostHelper.cs
- BitmapEffectGroup.cs
- WebPartConnectionsDisconnectVerb.cs
- LoadRetryStrategyFactory.cs
- MetadataWorkspace.cs
- IImplicitResourceProvider.cs
- BrowserDefinition.cs
- TimeSpanParse.cs
- SettingsSection.cs
- XmlSignatureManifest.cs
- ReferentialConstraint.cs
- CompareValidator.cs
- JapaneseCalendar.cs
- NativeMethods.cs
- SubclassTypeValidator.cs
- WorkflowViewManager.cs
- Select.cs
- PropertyGroupDescription.cs
- DataGridViewColumnCollection.cs
- HierarchicalDataSourceControl.cs
- graph.cs
- ModelItemCollection.cs
- _IPv6Address.cs
- CommandSet.cs
- LayoutTable.cs
- XpsFontSerializationService.cs
- ConstructorNeedsTagAttribute.cs
- ProfessionalColors.cs
- URL.cs
- DefaultSerializationProviderAttribute.cs
- Model3DGroup.cs
- DataGridViewDataConnection.cs
- ConfigurationValidatorBase.cs
- DataViewManagerListItemTypeDescriptor.cs
- ScalarRestriction.cs
- TryLoadRunnableWorkflowCommand.cs
- RIPEMD160Managed.cs
- ExternalFile.cs
- IDReferencePropertyAttribute.cs
- SqlDataSourceParameterParser.cs
- ExternalFile.cs
- PluralizationService.cs
- DbDataReader.cs
- RealizationContext.cs
- XmlMtomWriter.cs
- LinearGradientBrush.cs
- EventTrigger.cs
- BamlRecordReader.cs
- QilUnary.cs
- UmAlQuraCalendar.cs
- OverloadGroupAttribute.cs
- ResourceManager.cs
- CodeVariableDeclarationStatement.cs
- IncrementalHitTester.cs
- ObjectSet.cs
- BaseCodeDomTreeGenerator.cs
- Utils.cs
- CompilationPass2Task.cs
- RightsManagementInformation.cs
- ServiceParser.cs
- InternalMappingException.cs
- ProjectedWrapper.cs
- ReadWriteObjectLock.cs
- streamingZipPartStream.cs
- XPathSelectionIterator.cs
- Quaternion.cs
- HtmlTable.cs
- SoapSchemaExporter.cs
- AccessText.cs
- GridViewEditEventArgs.cs
- ValidatingPropertiesEventArgs.cs
- SqlBooleanMismatchVisitor.cs
- handlecollector.cs
- MetadataUtilsSmi.cs
- RequestCacheEntry.cs
- CompilerParameters.cs
- BaseTemplateCodeDomTreeGenerator.cs
- CorruptingExceptionCommon.cs
- AttributeCollection.cs
- ContentElement.cs
- SolidBrush.cs
- SQLInt32Storage.cs
- WebReferenceOptions.cs
- Request.cs
- EventBuilder.cs
- ObjectTag.cs
- SqlParameterCollection.cs
- LineGeometry.cs
- FrameworkContentElement.cs
- DesigntimeLicenseContext.cs
- SingleStorage.cs
- RadialGradientBrush.cs
- RenamedEventArgs.cs