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
- ApplicationFileCodeDomTreeGenerator.cs
- HtmlInputCheckBox.cs
- ListViewGroupConverter.cs
- HtmlSelect.cs
- IconBitmapDecoder.cs
- CryptoConfig.cs
- EntityDataSourceUtil.cs
- HtmlInputHidden.cs
- CqlParser.cs
- MethodSignatureGenerator.cs
- Calendar.cs
- _AcceptOverlappedAsyncResult.cs
- PolyQuadraticBezierSegment.cs
- SmtpNegotiateAuthenticationModule.cs
- PersonalizationStateInfo.cs
- OleDbCommandBuilder.cs
- Variable.cs
- SQLBoolean.cs
- ConnectionPoolManager.cs
- ExpressionBinding.cs
- ValueQuery.cs
- MetadataException.cs
- QilXmlWriter.cs
- IListConverters.cs
- InvokeMethodActivity.cs
- TextSpan.cs
- ThreadNeutralSemaphore.cs
- StructureChangedEventArgs.cs
- OciLobLocator.cs
- WebPartConnectVerb.cs
- WebReference.cs
- XmlExtensionFunction.cs
- CodeAccessPermission.cs
- NativeMethodsCLR.cs
- TextFormatterHost.cs
- VirtualizedContainerService.cs
- SamlAuthenticationClaimResource.cs
- XPathNodeList.cs
- ProgressBar.cs
- SizeAnimationBase.cs
- CollectionsUtil.cs
- QueryResults.cs
- HttpRuntimeSection.cs
- LastQueryOperator.cs
- BulletChrome.cs
- JoinElimination.cs
- BeginCreateSecurityTokenRequest.cs
- CookielessData.cs
- HexParser.cs
- RegexRunnerFactory.cs
- MutexSecurity.cs
- DynamicArgumentDialog.cs
- TargetInvocationException.cs
- XmlSchemaProviderAttribute.cs
- MtomMessageEncoder.cs
- GreenMethods.cs
- ObjectStateFormatter.cs
- PasswordPropertyTextAttribute.cs
- SqlBuilder.cs
- WebPartConnectionCollection.cs
- InputBinding.cs
- SecurityPolicySection.cs
- DataGridItem.cs
- PropertyIdentifier.cs
- DiffuseMaterial.cs
- XmlnsCache.cs
- TraceRecord.cs
- OptimizedTemplateContentHelper.cs
- DataGridViewLayoutData.cs
- KeyTime.cs
- SimpleBitVector32.cs
- PersonalizationProvider.cs
- TextEncodedRawTextWriter.cs
- ButtonField.cs
- GroupBox.cs
- DbConnectionPoolOptions.cs
- ControlCachePolicy.cs
- Token.cs
- AspProxy.cs
- WeakEventManager.cs
- DrawingBrush.cs
- ReadWriteSpinLock.cs
- TextDecorations.cs
- QuaternionAnimationBase.cs
- DesignerDataRelationship.cs
- Stylus.cs
- SetterBase.cs
- Renderer.cs
- LocatorBase.cs
- MultiViewDesigner.cs
- ClientProxyGenerator.cs
- AutomationAttributeInfo.cs
- PersonalizationState.cs
- ToolStripItemClickedEventArgs.cs
- EncryptedXml.cs
- DataSourceCache.cs
- CheckBoxField.cs
- _NTAuthentication.cs
- DesignerGenericWebPart.cs
- SecurityTokenProvider.cs