Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- safelinkcollection.cs
- ShapeTypeface.cs
- XmlChildNodes.cs
- InternalPermissions.cs
- SmiEventSink_DeferedProcessing.cs
- EventRouteFactory.cs
- DataGridViewCellCollection.cs
- VirtualizingPanel.cs
- XmlLanguage.cs
- PathFigure.cs
- ModelPropertyImpl.cs
- ContextBase.cs
- SafeNativeMethodsOther.cs
- MetaForeignKeyColumn.cs
- NeutralResourcesLanguageAttribute.cs
- EventManager.cs
- WebPartConnectionsEventArgs.cs
- TextEditorTables.cs
- BoundsDrawingContextWalker.cs
- CommandHelpers.cs
- ErrorView.xaml.cs
- MachinePropertyVariants.cs
- x509store.cs
- ExpressionLexer.cs
- DbProviderFactoriesConfigurationHandler.cs
- MultiTrigger.cs
- TypedTableGenerator.cs
- RunClient.cs
- ConvertTextFrag.cs
- DrawTreeNodeEventArgs.cs
- CustomWebEventKey.cs
- TypeConverterHelper.cs
- Maps.cs
- AttributeQuery.cs
- WpfWebRequestHelper.cs
- XamlFrame.cs
- BatchStream.cs
- ListViewInsertionMark.cs
- ClientData.cs
- HtmlInputFile.cs
- AccessText.cs
- LinearGradientBrush.cs
- NumberFunctions.cs
- SecurityToken.cs
- hebrewshape.cs
- autovalidator.cs
- ToolboxComponentsCreatingEventArgs.cs
- GridViewCellAutomationPeer.cs
- DataGridViewCellMouseEventArgs.cs
- DatatypeImplementation.cs
- HttpServerVarsCollection.cs
- documentation.cs
- CqlParser.cs
- assertwrapper.cs
- SevenBitStream.cs
- BinaryMethodMessage.cs
- SessionStateContainer.cs
- InputScopeManager.cs
- PagedControl.cs
- IsolatedStorageFilePermission.cs
- ChildTable.cs
- PersistenceException.cs
- XslVisitor.cs
- CaseInsensitiveHashCodeProvider.cs
- HtmlInputHidden.cs
- ExtensionFile.cs
- HandleExceptionArgs.cs
- SqlXmlStorage.cs
- TypeInitializationException.cs
- FrameworkTemplate.cs
- EntityDataSourceUtil.cs
- PipelineModuleStepContainer.cs
- RadialGradientBrush.cs
- SamlSubject.cs
- Wrapper.cs
- HttpCacheParams.cs
- ErrorsHelper.cs
- filewebresponse.cs
- ConfigViewGenerator.cs
- XmlSchemaValidationException.cs
- FragmentNavigationEventArgs.cs
- ControlBindingsCollection.cs
- SymbolMethod.cs
- MenuItemBinding.cs
- WhitespaceRule.cs
- RSAPKCS1SignatureDeformatter.cs
- Operators.cs
- MultiTouchSystemGestureLogic.cs
- PageClientProxyGenerator.cs
- WarningException.cs
- PropertyMappingExceptionEventArgs.cs
- DNS.cs
- MultiPropertyDescriptorGridEntry.cs
- TemplateBuilder.cs
- XmlDataSourceView.cs
- PartialCachingAttribute.cs
- HttpWriter.cs
- GridLengthConverter.cs
- FrameworkContentElementAutomationPeer.cs
- httpserverutility.cs