Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Extensions / UI / WebControls / LinqDataSourceHelper.cs / 1305376 / 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
- SystemIPv4InterfaceProperties.cs
- XmlDocumentType.cs
- ZipPackagePart.cs
- CodeTypeMember.cs
- MimeReturn.cs
- FlatButtonAppearance.cs
- loginstatus.cs
- DynamicExpression.cs
- FrameworkElementFactoryMarkupObject.cs
- PublisherIdentityPermission.cs
- WebPartConnectionsConfigureVerb.cs
- XmlText.cs
- TransactionChannel.cs
- ADMembershipProvider.cs
- SqlServices.cs
- IOException.cs
- DrawingImage.cs
- SwitchElementsCollection.cs
- SqlPersonalizationProvider.cs
- XmlSchema.cs
- TypeUnloadedException.cs
- DataMemberFieldEditor.cs
- SecurityUtils.cs
- ClientBuildManagerCallback.cs
- TextParagraphView.cs
- CachedFontFace.cs
- EntityEntry.cs
- QilSortKey.cs
- ZoneIdentityPermission.cs
- TargetException.cs
- SQLDecimalStorage.cs
- ZipIOBlockManager.cs
- HtmlLink.cs
- InheritanceContextHelper.cs
- DirtyTextRange.cs
- PeerNameRegistration.cs
- DispatcherTimer.cs
- CodeCastExpression.cs
- SrgsNameValueTag.cs
- GridViewColumn.cs
- RoleBoolean.cs
- EventsTab.cs
- DynamicActivityXamlReader.cs
- Inflater.cs
- NativeMethods.cs
- CryptoApi.cs
- XmlDictionaryString.cs
- SimplePropertyEntry.cs
- BaseTemplateBuildProvider.cs
- SelectionEditor.cs
- InkSerializer.cs
- GradientBrush.cs
- ClosableStream.cs
- SiteMapPath.cs
- UnicastIPAddressInformationCollection.cs
- RenderDataDrawingContext.cs
- SchemaLookupTable.cs
- PasswordRecoveryDesigner.cs
- DefaultProxySection.cs
- DataStorage.cs
- TypeConverterAttribute.cs
- XmlSchemaAnyAttribute.cs
- XamlTypeMapper.cs
- regiisutil.cs
- PrePostDescendentsWalker.cs
- DesignerActionVerbItem.cs
- unsafenativemethodstextservices.cs
- TreeChangeInfo.cs
- initElementDictionary.cs
- WorkflowPersistenceContext.cs
- SqlMetaData.cs
- DBDataPermission.cs
- NullableConverter.cs
- ReaderWriterLockWrapper.cs
- XmlNode.cs
- PriorityBinding.cs
- ReadOnlyAttribute.cs
- DocumentPageView.cs
- BitmapEffectInput.cs
- TextWriter.cs
- PresentationSource.cs
- TextCompositionManager.cs
- Vector3D.cs
- DefaultValidator.cs
- CursorEditor.cs
- BitmapMetadata.cs
- InstanceOwnerQueryResult.cs
- TimeStampChecker.cs
- PersistenceTypeAttribute.cs
- WebConfigurationHostFileChange.cs
- SecurityContextTokenValidationException.cs
- ConsoleKeyInfo.cs
- QuotedPairReader.cs
- XmlWriterSettings.cs
- Journaling.cs
- EndpointAddressMessageFilterTable.cs
- NumberSubstitution.cs
- GlobalEventManager.cs
- Command.cs
- LinkedDataMemberFieldEditor.cs