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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Size3D.cs
- ReadOnlyHierarchicalDataSource.cs
- TextSelectionProcessor.cs
- BindingWorker.cs
- Pen.cs
- DesignerWithHeader.cs
- SolidColorBrush.cs
- ConvertersCollection.cs
- Rotation3D.cs
- FatalException.cs
- ProvidePropertyAttribute.cs
- HuffModule.cs
- XPathNavigatorKeyComparer.cs
- Wrapper.cs
- SmtpDigestAuthenticationModule.cs
- XmlEnumAttribute.cs
- BamlRecordWriter.cs
- BasicBrowserDialog.designer.cs
- DbXmlEnabledProviderManifest.cs
- PageEventArgs.cs
- Matrix3DConverter.cs
- SettingsBindableAttribute.cs
- DataGrid.cs
- FillBehavior.cs
- FilterableAttribute.cs
- StoreAnnotationsMap.cs
- HMACSHA256.cs
- PhonemeConverter.cs
- Odbc32.cs
- HttpMethodAttribute.cs
- ConfigurationManagerHelper.cs
- OpCellTreeNode.cs
- MetabaseSettings.cs
- GrabHandleGlyph.cs
- ObjectViewListener.cs
- ParamArrayAttribute.cs
- BitmapCodecInfoInternal.cs
- Queue.cs
- Int32KeyFrameCollection.cs
- categoryentry.cs
- WebPartEditVerb.cs
- DataViewSettingCollection.cs
- CodeThrowExceptionStatement.cs
- AutoGeneratedField.cs
- SerTrace.cs
- JsonFormatGeneratorStatics.cs
- ThicknessAnimationUsingKeyFrames.cs
- OpenTypeLayoutCache.cs
- Crc32.cs
- PerformanceCounterManager.cs
- ToolStrip.cs
- SelfSignedCertificate.cs
- GridViewColumnCollectionChangedEventArgs.cs
- OdbcErrorCollection.cs
- ToolStripSplitButton.cs
- UncommonField.cs
- EntitySqlQueryCacheEntry.cs
- RunWorkerCompletedEventArgs.cs
- XmlBufferedByteStreamReader.cs
- EntityStoreSchemaFilterEntry.cs
- ExtentCqlBlock.cs
- NumberFunctions.cs
- FieldAccessException.cs
- MachineKeySection.cs
- RemoteWebConfigurationHost.cs
- DoubleConverter.cs
- EventWaitHandleSecurity.cs
- OpenTypeLayout.cs
- ExpressionBuilder.cs
- DateTime.cs
- ManagedWndProcTracker.cs
- CombinedHttpChannel.cs
- PeerNameRecord.cs
- ChtmlMobileTextWriter.cs
- GAC.cs
- externdll.cs
- MenuItemStyleCollection.cs
- InstanceDataCollection.cs
- PreProcessInputEventArgs.cs
- DataSourceSelectArguments.cs
- BaseValidator.cs
- TemplatedControlDesigner.cs
- ActivityExecutorSurrogate.cs
- ByteAnimation.cs
- HttpStaticObjectsCollectionBase.cs
- ResourcePermissionBase.cs
- NullableFloatSumAggregationOperator.cs
- Converter.cs
- DataSourceView.cs
- WebConfigurationFileMap.cs
- AttachedAnnotationChangedEventArgs.cs
- StrokeSerializer.cs
- ElementAction.cs
- ServiceModelEnumValidatorAttribute.cs
- Config.cs
- RSACryptoServiceProvider.cs
- Stroke2.cs
- JsonServiceDocumentSerializer.cs
- UInt64Storage.cs
- MobileComponentEditorPage.cs