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
- ProjectionPathSegment.cs
- EntityContainerRelationshipSetEnd.cs
- SimpleTypeResolver.cs
- ThicknessKeyFrameCollection.cs
- ArrayTypeMismatchException.cs
- OperationPickerDialog.designer.cs
- OleDbTransaction.cs
- ToolStripMenuItemDesigner.cs
- BindableTemplateBuilder.cs
- SimpleWebHandlerParser.cs
- LambdaCompiler.Address.cs
- ConfigXmlElement.cs
- safelinkcollection.cs
- TimeoutTimer.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- shaperfactoryquerycacheentry.cs
- DesignerAdapterAttribute.cs
- GeneralTransform2DTo3DTo2D.cs
- QuadTree.cs
- SiteMapNodeItem.cs
- FastPropertyAccessor.cs
- MemberInfoSerializationHolder.cs
- EntityDataSourceDesigner.cs
- StrongNameMembershipCondition.cs
- ColorConverter.cs
- ToolStripDropDownClosedEventArgs.cs
- ReceiveContent.cs
- FontFaceLayoutInfo.cs
- ToolStripDropDownMenu.cs
- Form.cs
- XPathAxisIterator.cs
- LinkedResource.cs
- CompilerParameters.cs
- Win32Exception.cs
- HttpModuleAction.cs
- Visual3DCollection.cs
- DataKey.cs
- IOThreadScheduler.cs
- SelectionPatternIdentifiers.cs
- PieceNameHelper.cs
- ComboBox.cs
- UiaCoreTypesApi.cs
- AsyncWaitHandle.cs
- ArcSegment.cs
- SystemIPAddressInformation.cs
- LiteralControl.cs
- DesignerToolboxInfo.cs
- CodeNamespaceImportCollection.cs
- SelectionChangedEventArgs.cs
- KeyValuePair.cs
- ScrollPattern.cs
- InvalidEnumArgumentException.cs
- IteratorDescriptor.cs
- _RequestLifetimeSetter.cs
- ThreadExceptionDialog.cs
- Transactions.cs
- ServiceContractDetailViewControl.cs
- ProviderSettingsCollection.cs
- InvokerUtil.cs
- SymbolDocumentGenerator.cs
- MenuAdapter.cs
- Latin1Encoding.cs
- HttpDictionary.cs
- RemotingServices.cs
- FocusManager.cs
- PerformanceCounter.cs
- FlowLayoutPanel.cs
- FileNotFoundException.cs
- ClientType.cs
- BinHexEncoder.cs
- ObjectViewEntityCollectionData.cs
- SafeFileMappingHandle.cs
- ButtonBaseAdapter.cs
- __Error.cs
- QueryableDataSourceHelper.cs
- CharEntityEncoderFallback.cs
- AttachedAnnotation.cs
- SqlCharStream.cs
- CompositionTarget.cs
- JsonFaultDetail.cs
- MulticastNotSupportedException.cs
- AuthenticodeSignatureInformation.cs
- InkPresenterAutomationPeer.cs
- NamespaceCollection.cs
- FrameworkContentElement.cs
- RichTextBox.cs
- BuildProviderAppliesToAttribute.cs
- HwndSource.cs
- SafeNativeMethods.cs
- ListViewSortEventArgs.cs
- WizardSideBarListControlItemEventArgs.cs
- DataMemberConverter.cs
- MessageBox.cs
- Material.cs
- StrokeCollectionConverter.cs
- XmlWrappingWriter.cs
- IntranetCredentialPolicy.cs
- DocumentPaginator.cs
- FileUtil.cs
- Attachment.cs