Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- QilFactory.cs
- BoundsDrawingContextWalker.cs
- DataColumn.cs
- ProtocolsConfigurationHandler.cs
- ReflectionServiceProvider.cs
- EventLogEntryCollection.cs
- DataContext.cs
- FindCriteriaCD1.cs
- GridSplitter.cs
- SocketSettings.cs
- EmissiveMaterial.cs
- XmlCodeExporter.cs
- SecurityUtils.cs
- DrawingGroup.cs
- CriticalExceptions.cs
- LinkClickEvent.cs
- AdvancedBindingPropertyDescriptor.cs
- ScrollItemPattern.cs
- SoapAttributes.cs
- TextDecoration.cs
- FieldBuilder.cs
- SystemIcmpV4Statistics.cs
- ScriptBehaviorDescriptor.cs
- TreeNodeStyleCollectionEditor.cs
- UIElement.cs
- DataRow.cs
- BinaryWriter.cs
- LinearGradientBrush.cs
- FocusWithinProperty.cs
- XmlArrayItemAttributes.cs
- baseshape.cs
- NopReturnReader.cs
- ModelTreeManager.cs
- ConfigsHelper.cs
- HashAlgorithm.cs
- CaseInsensitiveOrdinalStringComparer.cs
- ResourceReader.cs
- SynchronizationContext.cs
- SamlAttribute.cs
- MenuCommands.cs
- TraceContext.cs
- RelatedView.cs
- LinkUtilities.cs
- DataGridViewColumnEventArgs.cs
- HttpRuntimeSection.cs
- BindingValueChangedEventArgs.cs
- DefaultMemberAttribute.cs
- JumpList.cs
- wgx_exports.cs
- Type.cs
- X509Utils.cs
- GetCertificateRequest.cs
- WindowsStatic.cs
- ThreadNeutralSemaphore.cs
- CommunicationObjectAbortedException.cs
- GridViewSelectEventArgs.cs
- MsmqOutputSessionChannel.cs
- TransformProviderWrapper.cs
- ZeroOpNode.cs
- MetadataArtifactLoader.cs
- ProvidePropertyAttribute.cs
- Baml2006KnownTypes.cs
- XmlSchemaSimpleContentRestriction.cs
- DebugView.cs
- FreezableOperations.cs
- FlowPanelDesigner.cs
- RequestUriProcessor.cs
- TargetControlTypeAttribute.cs
- PathGeometry.cs
- HtmlTitle.cs
- PartialToken.cs
- Currency.cs
- VSWCFServiceContractGenerator.cs
- ServiceTimeoutsElement.cs
- ExpressionVisitor.cs
- XmlSchemaSimpleType.cs
- IndentedTextWriter.cs
- PersonalizablePropertyEntry.cs
- DataGridViewColumn.cs
- Size.cs
- HttpRuntime.cs
- TextParagraphView.cs
- PenContexts.cs
- XmlSchemaImporter.cs
- MessageVersion.cs
- InternalRelationshipCollection.cs
- SourceLineInfo.cs
- View.cs
- ToolStripItemEventArgs.cs
- EditorPartChrome.cs
- ScalarConstant.cs
- ZipIOLocalFileBlock.cs
- Pen.cs
- Debug.cs
- ComPlusInstanceProvider.cs
- Schema.cs
- ScriptMethodAttribute.cs
- DictionaryEntry.cs
- BamlRecords.cs
- base64Transforms.cs