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
- Random.cs
- CharacterHit.cs
- HostSecurityManager.cs
- CodePrimitiveExpression.cs
- PointCollection.cs
- CompiledRegexRunner.cs
- RuntimeWrappedException.cs
- dbenumerator.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- Button.cs
- DbConnectionHelper.cs
- CodeGen.cs
- StrokeCollectionConverter.cs
- FieldTemplateFactory.cs
- Simplifier.cs
- ProfileSection.cs
- ConfigurationLoader.cs
- SoapServerProtocol.cs
- InProcStateClientManager.cs
- MetadataSource.cs
- ListComponentEditor.cs
- TokenFactoryBase.cs
- ProviderManager.cs
- TemplateParser.cs
- CharacterHit.cs
- TableItemProviderWrapper.cs
- ProcessDesigner.cs
- ColorConvertedBitmapExtension.cs
- IssuedTokenClientElement.cs
- datacache.cs
- ThreadExceptionDialog.cs
- ExpressionBinding.cs
- DataIdProcessor.cs
- WindowsAuthenticationEventArgs.cs
- FaultDescriptionCollection.cs
- HealthMonitoringSection.cs
- SrgsElementFactory.cs
- ColorAnimation.cs
- LinkButton.cs
- GraphicsState.cs
- BamlWriter.cs
- ButtonChrome.cs
- EngineSiteSapi.cs
- AttributeCollection.cs
- FormatterServices.cs
- TabletCollection.cs
- Win32Native.cs
- Authorization.cs
- DocumentGridContextMenu.cs
- WindowsGraphics2.cs
- ColorAnimation.cs
- ImmutableObjectAttribute.cs
- ObjectListDesigner.cs
- ExecutionEngineException.cs
- DateTimeValueSerializerContext.cs
- WebPartConnectVerb.cs
- Encoding.cs
- SoapObjectReader.cs
- NamespaceTable.cs
- ProfileProvider.cs
- Pair.cs
- Evidence.cs
- DefaultMemberAttribute.cs
- OutputCacheSettings.cs
- ChooseAction.cs
- ContextInformation.cs
- EdmRelationshipNavigationPropertyAttribute.cs
- DiagnosticSection.cs
- MatchAttribute.cs
- TypeNameParser.cs
- ProxySimple.cs
- KeyFrames.cs
- ZipPackagePart.cs
- SelectorAutomationPeer.cs
- SecurityManager.cs
- ChildrenQuery.cs
- SequentialUshortCollection.cs
- MemoryMappedViewAccessor.cs
- CompilerGeneratedAttribute.cs
- WinEventHandler.cs
- Size3D.cs
- PkcsMisc.cs
- BoolLiteral.cs
- AssemblyBuilder.cs
- Model3D.cs
- CultureSpecificCharacterBufferRange.cs
- XmlObjectSerializerReadContextComplexJson.cs
- TypeUnloadedException.cs
- UICuesEvent.cs
- AbstractExpressions.cs
- EmbeddedMailObjectCollectionEditor.cs
- RangeValuePattern.cs
- XmlArrayAttribute.cs
- util.cs
- MimeFormatter.cs
- DataGridViewColumnEventArgs.cs
- BoundField.cs
- UnknownBitmapDecoder.cs
- ExtractedStateEntry.cs
- QilCloneVisitor.cs