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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TableItemPattern.cs
- OdbcDataReader.cs
- EventListener.cs
- XmlnsDefinitionAttribute.cs
- SystemIcons.cs
- OdbcPermission.cs
- AssemblyInfo.cs
- BinaryObjectWriter.cs
- Module.cs
- PersistenceMetadataNamespace.cs
- BinaryFormatter.cs
- PropertyMapper.cs
- DesignParameter.cs
- TransactionInterop.cs
- MissingManifestResourceException.cs
- DefaultWorkflowTransactionService.cs
- TemplateControlParser.cs
- MappingSource.cs
- BinaryObjectReader.cs
- HandlerBase.cs
- DiscoveryInnerClientAdhoc11.cs
- PersonalizationEntry.cs
- ImageSource.cs
- BamlTreeUpdater.cs
- TextDpi.cs
- ParserExtension.cs
- SafeBitVector32.cs
- MatrixCamera.cs
- DesignerCategoryAttribute.cs
- TagNameToTypeMapper.cs
- ZipIOEndOfCentralDirectoryBlock.cs
- ParserStreamGeometryContext.cs
- FocusManager.cs
- HtmlInputHidden.cs
- ItemCheckEvent.cs
- OdbcFactory.cs
- EncodingStreamWrapper.cs
- ExpressionBuilderCollection.cs
- OdbcErrorCollection.cs
- PolicyValidationException.cs
- HebrewNumber.cs
- RectangleConverter.cs
- CompressedStack.cs
- TextEffectResolver.cs
- ErrorProvider.cs
- KeyValueInternalCollection.cs
- XmlFormatExtensionAttribute.cs
- TagPrefixAttribute.cs
- HeaderedItemsControl.cs
- ImpersonateTokenRef.cs
- EncodingTable.cs
- _SSPIWrapper.cs
- TraceHandlerErrorFormatter.cs
- PackageDigitalSignature.cs
- AssemblyBuilder.cs
- KeyToListMap.cs
- DesignUtil.cs
- MemberDomainMap.cs
- InstanceLockedException.cs
- Drawing.cs
- CookieProtection.cs
- NonClientArea.cs
- OpCellTreeNode.cs
- RIPEMD160Managed.cs
- RankException.cs
- TableAdapterManagerNameHandler.cs
- DataServiceCollectionOfT.cs
- ContainerControl.cs
- DownloadProgressEventArgs.cs
- CodeEventReferenceExpression.cs
- FileLogRecord.cs
- MarshalByRefObject.cs
- MSAANativeProvider.cs
- Quad.cs
- SmuggledIUnknown.cs
- OleDbWrapper.cs
- ProtocolsConfigurationHandler.cs
- GridItem.cs
- ByeOperationAsyncResult.cs
- DrawingGroup.cs
- ObjectTag.cs
- RoamingStoreFile.cs
- errorpatternmatcher.cs
- RegexBoyerMoore.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- KnownBoxes.cs
- SqlEnums.cs
- SimpleBitVector32.cs
- TabItem.cs
- ModelMemberCollection.cs
- FormViewModeEventArgs.cs
- CodeTypeParameterCollection.cs
- RepeaterItemCollection.cs
- Terminate.cs
- ValidationResults.cs
- SimpleApplicationHost.cs
- XmlSchemaSimpleContent.cs
- ProjectionCamera.cs
- CodeBlockBuilder.cs
- TreeWalker.cs