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
- ListViewItem.cs
- IncrementalCompileAnalyzer.cs
- SecurityManager.cs
- FixedSOMTextRun.cs
- RtfControls.cs
- SQLDecimalStorage.cs
- InvalidOperationException.cs
- XmlSchemaExporter.cs
- WindowsToolbarItemAsMenuItem.cs
- altserialization.cs
- CompilationRelaxations.cs
- ReadContentAsBinaryHelper.cs
- DriveInfo.cs
- MatchSingleFxEngineOpcode.cs
- TimeSpanStorage.cs
- LightweightCodeGenerator.cs
- DBCSCodePageEncoding.cs
- UriTemplatePathSegment.cs
- RuleInfoComparer.cs
- WebPartCollection.cs
- ImageListStreamer.cs
- BackgroundWorker.cs
- IdentityNotMappedException.cs
- MarkupCompilePass1.cs
- Ipv6Element.cs
- VBCodeProvider.cs
- OraclePermission.cs
- Transform.cs
- HwndTarget.cs
- Sequence.cs
- RelatedPropertyManager.cs
- ImageCodecInfoPrivate.cs
- ObjectViewQueryResultData.cs
- SqlWebEventProvider.cs
- GuidTagList.cs
- URLString.cs
- ConfigXmlAttribute.cs
- PreservationFileReader.cs
- AnnotationHighlightLayer.cs
- X509SubjectKeyIdentifierClause.cs
- HelpInfo.cs
- EntityConnection.cs
- HttpListenerException.cs
- DigestComparer.cs
- StringCollection.cs
- CollectionConverter.cs
- XmlNavigatorFilter.cs
- HierarchicalDataSourceControl.cs
- FastPropertyAccessor.cs
- ValuePattern.cs
- TextBox.cs
- DataRowCollection.cs
- VerticalAlignConverter.cs
- MsmqAuthenticationMode.cs
- SqlDataSourceCommandEventArgs.cs
- AutomationPropertyInfo.cs
- ComponentDispatcher.cs
- UIElement3D.cs
- ClientApiGenerator.cs
- InvariantComparer.cs
- SerializationEventsCache.cs
- WSSecurityOneDotZeroSendSecurityHeader.cs
- ConfigUtil.cs
- DataBoundControlHelper.cs
- IgnoreFileBuildProvider.cs
- WebPartZone.cs
- WorkflowViewElement.cs
- PrintingPermission.cs
- AutomationElementCollection.cs
- PageWrapper.cs
- BamlTreeMap.cs
- MetadataArtifactLoaderFile.cs
- DbSetClause.cs
- UpWmlMobileTextWriter.cs
- QilTypeChecker.cs
- ValidationHelper.cs
- DeobfuscatingStream.cs
- ApplicationServiceManager.cs
- ScriptReferenceEventArgs.cs
- DbModificationClause.cs
- DoubleLinkList.cs
- FacetValues.cs
- Pen.cs
- ResourceReader.cs
- SelectionWordBreaker.cs
- TypeElementCollection.cs
- ThreadPool.cs
- Line.cs
- ClientScriptManager.cs
- PassportAuthenticationModule.cs
- InnerItemCollectionView.cs
- IsolatedStorageFilePermission.cs
- ScrollBarRenderer.cs
- CrossContextChannel.cs
- XmlEncoding.cs
- EdmComplexTypeAttribute.cs
- FixedHyperLink.cs
- SqlDependency.cs
- XmlQualifiedNameTest.cs
- InternalConfigSettingsFactory.cs