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
- RoleBoolean.cs
- BrowserCapabilitiesFactory35.cs
- TableCell.cs
- DataKeyArray.cs
- WebCategoryAttribute.cs
- FixedNode.cs
- WorkflowServiceBehavior.cs
- RestHandler.cs
- CalendarDay.cs
- safex509handles.cs
- ResourcesChangeInfo.cs
- LinqDataSourceSelectEventArgs.cs
- DesignerView.cs
- XamlReaderConstants.cs
- WorkflowOperationContext.cs
- Calendar.cs
- OutputCacheSettingsSection.cs
- SID.cs
- PropertyToken.cs
- MaterialGroup.cs
- TypeCollectionPropertyEditor.cs
- ModuleBuilderData.cs
- InfoCardRSAPKCS1SignatureFormatter.cs
- GenericNameHandler.cs
- XamlSerializer.cs
- ScriptingAuthenticationServiceSection.cs
- ListItemConverter.cs
- OutputCacheProfileCollection.cs
- SqlClientPermission.cs
- RuntimeHandles.cs
- StandardMenuStripVerb.cs
- CharUnicodeInfo.cs
- TextReturnReader.cs
- DbProviderConfigurationHandler.cs
- GlyphsSerializer.cs
- ExtensionQuery.cs
- XmlAttributeCache.cs
- OletxVolatileEnlistment.cs
- Size.cs
- Transform.cs
- propertytag.cs
- Delegate.cs
- _LocalDataStore.cs
- OleDbCommand.cs
- Identity.cs
- LogExtent.cs
- XmlILTrace.cs
- InvalidCommandTreeException.cs
- ClientConfigPaths.cs
- TypeAccessException.cs
- AccessDataSourceDesigner.cs
- SafeBitVector32.cs
- StreamMarshaler.cs
- WebPartConnectionsDisconnectVerb.cs
- VirtualDirectoryMappingCollection.cs
- EditorZoneAutoFormat.cs
- Exceptions.cs
- WorkflowInstanceUnhandledExceptionRecord.cs
- WorkerRequest.cs
- EntitySqlQueryCacheKey.cs
- RangeExpression.cs
- FrameDimension.cs
- CollectionBase.cs
- EditorBrowsableAttribute.cs
- CharacterMetricsDictionary.cs
- TimeoutValidationAttribute.cs
- _ShellExpression.cs
- MetadataPropertyAttribute.cs
- CompatibleComparer.cs
- LinearQuaternionKeyFrame.cs
- XmlSchemaSimpleType.cs
- PeerDefaultCustomResolverClient.cs
- DoubleLinkListEnumerator.cs
- ComponentResourceManager.cs
- DesignerAttributeInfo.cs
- ProjectionPath.cs
- SessionStateModule.cs
- SQLInt64Storage.cs
- InvalidOleVariantTypeException.cs
- ImageAutomationPeer.cs
- SocketElement.cs
- RewritingProcessor.cs
- Win32SafeHandles.cs
- SoapHelper.cs
- XmlSchemaObject.cs
- CodeObjectCreateExpression.cs
- DataRecordObjectView.cs
- SemanticBasicElement.cs
- SettingsContext.cs
- TableRow.cs
- ToolboxComponentsCreatingEventArgs.cs
- Compress.cs
- DesignerDataSchemaClass.cs
- Identity.cs
- PersonalizationProviderHelper.cs
- BasicBrowserDialog.designer.cs
- FilteredReadOnlyMetadataCollection.cs
- ListViewTableRow.cs
- SqlPersistenceWorkflowInstanceDescription.cs
- NativeMethodsCLR.cs