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
- TypeToArgumentTypeConverter.cs
- Int32Rect.cs
- HtmlTableCellCollection.cs
- TreeNodeStyleCollection.cs
- TimelineClockCollection.cs
- SuppressIldasmAttribute.cs
- TextEmbeddedObject.cs
- BoundingRectTracker.cs
- DataGridViewTextBoxCell.cs
- ClientFormsIdentity.cs
- Cursor.cs
- SqlDataSourceWizardForm.cs
- DocumentPageView.cs
- BindToObject.cs
- SortKey.cs
- ClientConfigPaths.cs
- InputEventArgs.cs
- AnchoredBlock.cs
- PermissionListSet.cs
- WindowsComboBox.cs
- JsonFormatWriterGenerator.cs
- CacheDependency.cs
- Item.cs
- AnimatedTypeHelpers.cs
- ProtectedConfigurationProviderCollection.cs
- ExpressionBuilderContext.cs
- BigInt.cs
- FlagsAttribute.cs
- CLRBindingWorker.cs
- ToolBar.cs
- RadioButton.cs
- MailWriter.cs
- ContentHostHelper.cs
- NumberAction.cs
- TextTreeNode.cs
- ConstructorExpr.cs
- Identity.cs
- ProfileManager.cs
- DelayedRegex.cs
- SemanticResultValue.cs
- EditableRegion.cs
- BitmapPalette.cs
- IPEndPointCollection.cs
- ManagementOptions.cs
- Command.cs
- MasterPageCodeDomTreeGenerator.cs
- ServiceChannelProxy.cs
- ActivationServices.cs
- DeclarativeCatalogPart.cs
- ZipIOExtraFieldZip64Element.cs
- WebPartsPersonalizationAuthorization.cs
- FloatSumAggregationOperator.cs
- SmtpClient.cs
- wgx_exports.cs
- StoragePropertyMapping.cs
- SqlTrackingService.cs
- SQLDouble.cs
- VisualStyleElement.cs
- MenuEventArgs.cs
- BindableTemplateBuilder.cs
- FileSystemWatcher.cs
- SqlRetyper.cs
- WebServiceData.cs
- GrammarBuilderPhrase.cs
- NetSectionGroup.cs
- SoapInteropTypes.cs
- WorkflowEnvironment.cs
- TableLayoutSettings.cs
- DataGridViewColumnCollection.cs
- ColumnMap.cs
- StackSpiller.cs
- ToolStripRendererSwitcher.cs
- FlowDocumentReaderAutomationPeer.cs
- TextDecorationCollection.cs
- TextTreeExtractElementUndoUnit.cs
- OutOfMemoryException.cs
- PartBasedPackageProperties.cs
- XmlDataSourceView.cs
- CqlIdentifiers.cs
- BindingEditor.xaml.cs
- UpDownBase.cs
- ResourceDictionaryCollection.cs
- ModifiableIteratorCollection.cs
- CommandLibraryHelper.cs
- AsyncContentLoadedEventArgs.cs
- ApplicationProxyInternal.cs
- GeometryModel3D.cs
- PackageDocument.cs
- XmlAnyAttributeAttribute.cs
- NameTable.cs
- IncrementalCompileAnalyzer.cs
- ListChangedEventArgs.cs
- ErrorWebPart.cs
- WindowCollection.cs
- LinqDataSourceUpdateEventArgs.cs
- ZeroOpNode.cs
- HMACSHA384.cs
- ContractMapping.cs
- DetailsViewActionList.cs
- PageCodeDomTreeGenerator.cs