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
- ConstructorExpr.cs
- SourceChangedEventArgs.cs
- OdbcCommandBuilder.cs
- ZipIOExtraFieldElement.cs
- NavigationHelper.cs
- MessagePropertyFilter.cs
- JapaneseLunisolarCalendar.cs
- ServiceOperationListItem.cs
- MenuAutomationPeer.cs
- InvariantComparer.cs
- TypeDescriptorContext.cs
- thaishape.cs
- WeakReferenceKey.cs
- FacetValues.cs
- DesignerListAdapter.cs
- AttachedPropertyBrowsableAttribute.cs
- CommandExpr.cs
- ReadWriteObjectLock.cs
- PersianCalendar.cs
- TransactionalPackage.cs
- diagnosticsswitches.cs
- jithelpers.cs
- ConfigurationConverterBase.cs
- ListViewUpdatedEventArgs.cs
- OleDbTransaction.cs
- InvokeBinder.cs
- WindowsBrush.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- CultureSpecificCharacterBufferRange.cs
- DispatchWrapper.cs
- Privilege.cs
- PolygonHotSpot.cs
- StatusStrip.cs
- DynamicPropertyReader.cs
- ProtectedConfigurationProviderCollection.cs
- EpmTargetTree.cs
- MembershipValidatePasswordEventArgs.cs
- Int64Storage.cs
- PrinterSettings.cs
- WebCategoryAttribute.cs
- LinqDataSourceStatusEventArgs.cs
- XsltOutput.cs
- Matrix3DStack.cs
- ToolBarButton.cs
- SqlTopReducer.cs
- DataDocumentXPathNavigator.cs
- TextBoxLine.cs
- CollectionsUtil.cs
- XmlDownloadManager.cs
- HtmlAnchor.cs
- BitmapEffectRenderDataResource.cs
- RegexMatchCollection.cs
- PenCursorManager.cs
- TableParagraph.cs
- BinaryObjectWriter.cs
- SQLMembershipProvider.cs
- SimpleType.cs
- ContextProperty.cs
- ScrollProperties.cs
- InputMethod.cs
- FontNamesConverter.cs
- RangeValuePattern.cs
- ChannelProtectionRequirements.cs
- QilSortKey.cs
- TreeWalker.cs
- WindowsTokenRoleProvider.cs
- BamlRecords.cs
- ZipIOLocalFileDataDescriptor.cs
- TemplateKey.cs
- GenerateDerivedKeyRequest.cs
- Button.cs
- ViewBase.cs
- ConversionContext.cs
- BinaryObjectWriter.cs
- PerformanceCounterPermissionEntry.cs
- ZipIOLocalFileHeader.cs
- RegexWorker.cs
- StateItem.cs
- BufferedGraphicsManager.cs
- SiteMapProvider.cs
- mediapermission.cs
- XLinq.cs
- GlobalizationAssembly.cs
- DebuggerAttributes.cs
- SqlRetyper.cs
- ProfileProvider.cs
- diagnosticsswitches.cs
- SplitContainerDesigner.cs
- BamlRecordReader.cs
- XmlILIndex.cs
- RequestReplyCorrelator.cs
- DependencyObjectCodeDomSerializer.cs
- CompressStream.cs
- ViewEventArgs.cs
- ConfigurationManagerInternalFactory.cs
- SecurityTokenException.cs
- oledbconnectionstring.cs
- ContextMenuStrip.cs
- CompositeControl.cs
- TextEditorMouse.cs