Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Extensions / UI / WebControls / LinqDataSourceHelper.cs / 1305376 / 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
- BinaryMethodMessage.cs
- GcHandle.cs
- _DigestClient.cs
- HtmlWindowCollection.cs
- RegexCompiler.cs
- propertytag.cs
- WsatConfiguration.cs
- CodeDelegateInvokeExpression.cs
- ResizeBehavior.cs
- DtdParser.cs
- ByteRangeDownloader.cs
- TransportManager.cs
- TextParagraphView.cs
- Soap.cs
- CodeCompileUnit.cs
- DesignerAdapterAttribute.cs
- MessageQueueEnumerator.cs
- XamlReaderConstants.cs
- WindowsButton.cs
- ReturnValue.cs
- XPathException.cs
- HostSecurityManager.cs
- CacheChildrenQuery.cs
- FormViewAutoFormat.cs
- OAVariantLib.cs
- storepermission.cs
- WindowsAltTab.cs
- FocusChangedEventArgs.cs
- XmlObjectSerializerWriteContextComplex.cs
- VariableAction.cs
- ContextMarshalException.cs
- WorkflowInlining.cs
- CommonRemoteMemoryBlock.cs
- TraceLog.cs
- VoiceInfo.cs
- EnumValAlphaComparer.cs
- HostElement.cs
- DBSchemaTable.cs
- EventTask.cs
- ExpressionPrinter.cs
- mil_sdk_version.cs
- GroupBoxAutomationPeer.cs
- ToolStripRenderEventArgs.cs
- ToolStripScrollButton.cs
- Guid.cs
- DriveNotFoundException.cs
- RealProxy.cs
- DataColumnCollection.cs
- XhtmlTextWriter.cs
- SamlAttributeStatement.cs
- ConnectionInterfaceCollection.cs
- DataGrid.cs
- ConnectionStringsExpressionBuilder.cs
- PolyLineSegment.cs
- WindowsScrollBarBits.cs
- XamlRtfConverter.cs
- WindowsListViewItemCheckBox.cs
- ApplicationInfo.cs
- GridViewDeletedEventArgs.cs
- ThreadStateException.cs
- FrameworkContentElement.cs
- TreeNodeConverter.cs
- MbpInfo.cs
- QueryContinueDragEvent.cs
- HttpRequestCacheValidator.cs
- DaylightTime.cs
- sqlstateclientmanager.cs
- DisplayMemberTemplateSelector.cs
- VisualStyleElement.cs
- XmlName.cs
- NegationPusher.cs
- MailBnfHelper.cs
- Timer.cs
- DataIdProcessor.cs
- StylusPointPropertyUnit.cs
- DockProviderWrapper.cs
- PerformanceCounterManager.cs
- TextUtf8RawTextWriter.cs
- PrincipalPermission.cs
- DataSvcMapFileSerializer.cs
- DrawingBrush.cs
- BaseDataListActionList.cs
- SecurityChannel.cs
- LineBreakRecord.cs
- PointLight.cs
- _SSPISessionCache.cs
- GridViewUpdateEventArgs.cs
- ExpressionServices.cs
- ContainerFilterService.cs
- XPathExpr.cs
- CodeThrowExceptionStatement.cs
- MissingFieldException.cs
- StateManagedCollection.cs
- ExpressionBindingCollection.cs
- GridErrorDlg.cs
- FormsIdentity.cs
- PageContentCollection.cs
- RootBrowserWindow.cs
- RadioButtonList.cs
- SubMenuStyle.cs