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
- TreeView.cs
- Color.cs
- FileUtil.cs
- FontFaceLayoutInfo.cs
- GridViewUpdateEventArgs.cs
- TaskFormBase.cs
- WorkflowService.cs
- ConvertersCollection.cs
- ActivityCodeDomSerializationManager.cs
- AuthenticationException.cs
- StringUtil.cs
- DataKeyArray.cs
- FlowDocumentReader.cs
- TextTreeExtractElementUndoUnit.cs
- SQLDateTime.cs
- PartialTrustVisibleAssembliesSection.cs
- StatusBarItemAutomationPeer.cs
- Internal.cs
- DefinitionUpdate.cs
- CompoundFileIOPermission.cs
- SortKey.cs
- SqlDataSourceCommandEventArgs.cs
- cryptoapiTransform.cs
- RootBuilder.cs
- QuotedPrintableStream.cs
- InputProcessorProfiles.cs
- TextTreeTextElementNode.cs
- ObjectParameterCollection.cs
- CollectionViewProxy.cs
- ChangeTracker.cs
- SmiMetaDataProperty.cs
- XmlResolver.cs
- xsdvalidator.cs
- XPathParser.cs
- NotCondition.cs
- NativeRightsManagementAPIsStructures.cs
- SafeEventLogWriteHandle.cs
- XmlSchemaDatatype.cs
- DataGridViewElement.cs
- DocumentSequence.cs
- ImageMap.cs
- WebSysDefaultValueAttribute.cs
- EventProxy.cs
- QueryReaderSettings.cs
- SafeNativeMethods.cs
- Misc.cs
- EntityDataReader.cs
- Math.cs
- FrameworkElement.cs
- FolderLevelBuildProviderAppliesToAttribute.cs
- Propagator.Evaluator.cs
- WMICapabilities.cs
- XmlRootAttribute.cs
- HtmlGenericControl.cs
- GridViewRowEventArgs.cs
- TextTreeUndo.cs
- RegexGroup.cs
- configsystem.cs
- DrawingBrush.cs
- TextCompositionManager.cs
- AdapterDictionary.cs
- StandardCommands.cs
- CultureSpecificStringDictionary.cs
- ThreadInterruptedException.cs
- XPathAncestorIterator.cs
- SelectedGridItemChangedEvent.cs
- ArgumentValidation.cs
- TextServicesProperty.cs
- IndexedString.cs
- figurelength.cs
- ProviderSettings.cs
- ConsoleKeyInfo.cs
- SocketException.cs
- Panel.cs
- Positioning.cs
- ActivityInterfaces.cs
- ObjectDataSourceFilteringEventArgs.cs
- RecordManager.cs
- SecurityUniqueId.cs
- CssStyleCollection.cs
- _SSPISessionCache.cs
- HwndProxyElementProvider.cs
- LabelTarget.cs
- Int32Rect.cs
- OdbcErrorCollection.cs
- MenuAdapter.cs
- SpellerError.cs
- _NTAuthentication.cs
- GlyphRun.cs
- Facet.cs
- Pen.cs
- ErrorRuntimeConfig.cs
- ConfigurationValidatorAttribute.cs
- PolicyStatement.cs
- GcSettings.cs
- BindingFormattingDialog.cs
- ExponentialEase.cs
- invalidudtexception.cs
- RuntimeResourceSet.cs
- Literal.cs