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
- Icon.cs
- UpdatePanelTrigger.cs
- CustomWebEventKey.cs
- FixedSOMContainer.cs
- FileDataSourceCache.cs
- FormViewInsertedEventArgs.cs
- IconBitmapDecoder.cs
- ParamArrayAttribute.cs
- EntityStoreSchemaFilterEntry.cs
- TimeIntervalCollection.cs
- ParseNumbers.cs
- ReadContentAsBinaryHelper.cs
- LassoHelper.cs
- ZipIORawDataFileBlock.cs
- ButtonFieldBase.cs
- EdmTypeAttribute.cs
- AsnEncodedData.cs
- XmlReflectionMember.cs
- CaseKeyBox.ViewModel.cs
- Bitmap.cs
- ClientConvert.cs
- ScriptingAuthenticationServiceSection.cs
- SoundPlayer.cs
- SqlWebEventProvider.cs
- ManagementObject.cs
- ProfileSettings.cs
- DefaultValueAttribute.cs
- DetailsView.cs
- TraceXPathNavigator.cs
- WaitHandleCannotBeOpenedException.cs
- ColumnProvider.cs
- ConfigurationLocationCollection.cs
- EventDescriptor.cs
- __FastResourceComparer.cs
- Condition.cs
- PageBreakRecord.cs
- ConsumerConnectionPointCollection.cs
- SR.cs
- RegexFCD.cs
- BidOverLoads.cs
- Image.cs
- PrimarySelectionAdorner.cs
- WindowsSlider.cs
- sqlcontext.cs
- DuplexClientBase.cs
- SystemEvents.cs
- StringConverter.cs
- StylusCollection.cs
- SerializationFieldInfo.cs
- FillErrorEventArgs.cs
- XdrBuilder.cs
- EntityContainer.cs
- FrameworkContextData.cs
- KeyInstance.cs
- TableParaClient.cs
- AppDomainCompilerProxy.cs
- DispatchChannelSink.cs
- PointConverter.cs
- NonBatchDirectoryCompiler.cs
- Vector.cs
- PenLineJoinValidation.cs
- Accessible.cs
- ColorConverter.cs
- GlobalAclOperationRequirement.cs
- ReceiveContent.cs
- XamlTypeMapper.cs
- ReadOnlyPropertyMetadata.cs
- Literal.cs
- Constant.cs
- SelectionManager.cs
- MatrixTransform3D.cs
- UserControl.cs
- TextViewBase.cs
- WebPartTracker.cs
- BufferedGraphicsManager.cs
- TreeView.cs
- SqlPersonalizationProvider.cs
- WindowsGraphics.cs
- CatalogZoneBase.cs
- Rect3DConverter.cs
- SqlConnectionPoolGroupProviderInfo.cs
- COM2Properties.cs
- AuthenticationModulesSection.cs
- SQLMembershipProvider.cs
- SqlDataAdapter.cs
- HostingMessageProperty.cs
- ConfigXmlComment.cs
- EncoderFallback.cs
- errorpatternmatcher.cs
- FormsAuthenticationModule.cs
- ImageFormatConverter.cs
- MasterPage.cs
- SkinBuilder.cs
- ConfigXmlComment.cs
- LinearKeyFrames.cs
- DeferredElementTreeState.cs
- SetterBaseCollection.cs
- GeneralTransform2DTo3DTo2D.cs
- XmlDataSourceNodeDescriptor.cs
- MarkupProperty.cs