Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- BoolExpression.cs
- SubpageParaClient.cs
- ObjectViewEntityCollectionData.cs
- metadatamappinghashervisitor.hashsourcebuilder.cs
- StringUtil.cs
- ExpandCollapsePattern.cs
- DocumentViewer.cs
- ThousandthOfEmRealDoubles.cs
- Vector3DCollectionConverter.cs
- EventRoute.cs
- SqlUdtInfo.cs
- XmlnsCompatibleWithAttribute.cs
- LinkedList.cs
- StaticTextPointer.cs
- SettingsAttributeDictionary.cs
- ListViewVirtualItemsSelectionRangeChangedEvent.cs
- HttpWebResponse.cs
- FileUpload.cs
- ProtocolsConfigurationEntry.cs
- WebPartEditorCancelVerb.cs
- XmlnsDefinitionAttribute.cs
- AnonymousIdentificationSection.cs
- NativeMethods.cs
- TransactionFlowElement.cs
- IndependentAnimationStorage.cs
- XmlDataLoader.cs
- CultureMapper.cs
- EventProxy.cs
- SendParametersContent.cs
- RuntimeConfig.cs
- SafeSecurityHelper.cs
- DesignTimeData.cs
- XmlDictionaryWriter.cs
- TextSearch.cs
- DbTransaction.cs
- TimeSpanSecondsConverter.cs
- SwitchElementsCollection.cs
- PriorityQueue.cs
- SqlDataSource.cs
- QueryInterceptorAttribute.cs
- brushes.cs
- CodeCompiler.cs
- DataShape.cs
- DateTimeEditor.cs
- SoapInteropTypes.cs
- ConsumerConnectionPoint.cs
- BooleanAnimationBase.cs
- PictureBoxDesigner.cs
- CopyNamespacesAction.cs
- WebPartDescriptionCollection.cs
- BindingSource.cs
- SocketStream.cs
- Page.cs
- PageAsyncTaskManager.cs
- XpsImage.cs
- PackageDigitalSignatureManager.cs
- ContactManager.cs
- TimeSpanValidator.cs
- OrderingExpression.cs
- XmlSchemaGroupRef.cs
- SocketElement.cs
- OutputCacheSection.cs
- XmlCustomFormatter.cs
- FigureHelper.cs
- BaseUriHelper.cs
- InstanceData.cs
- ReadOnlyHierarchicalDataSourceView.cs
- TextDecorations.cs
- webeventbuffer.cs
- TypeCollectionDesigner.xaml.cs
- UserControl.cs
- ISAPIRuntime.cs
- ReachSerializableProperties.cs
- ErrorFormatter.cs
- StrokeRenderer.cs
- Queue.cs
- ObjectViewEntityCollectionData.cs
- LocationUpdates.cs
- TdsParser.cs
- LiteralControl.cs
- UserMapPath.cs
- DataKeyCollection.cs
- CustomError.cs
- AttributeUsageAttribute.cs
- ComPlusInstanceContextInitializer.cs
- AppDomainFactory.cs
- SpellCheck.cs
- EncodingConverter.cs
- SystemIPv6InterfaceProperties.cs
- EnumMember.cs
- DBCSCodePageEncoding.cs
- OutputScopeManager.cs
- TextLine.cs
- TrackingWorkflowEventArgs.cs
- PageAsyncTaskManager.cs
- SqlConnectionPoolGroupProviderInfo.cs
- UpdatePanel.cs
- ListBindingHelper.cs
- Unit.cs
- EncryptedData.cs