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
- InputDevice.cs
- BitmapFrameEncode.cs
- GenericUriParser.cs
- CodeDomConfigurationHandler.cs
- OneOfElement.cs
- sitestring.cs
- Control.cs
- CoTaskMemHandle.cs
- IntellisenseTextBox.designer.cs
- SqlClientWrapperSmiStreamChars.cs
- CalendarDataBindingHandler.cs
- Msec.cs
- LocatorPartList.cs
- PKCS1MaskGenerationMethod.cs
- DrawingGroup.cs
- ToolStripStatusLabel.cs
- IDReferencePropertyAttribute.cs
- InternalControlCollection.cs
- LicenseManager.cs
- SafeLibraryHandle.cs
- ProfileManager.cs
- CommonProperties.cs
- HuffModule.cs
- ParameterModifier.cs
- rsa.cs
- XmlAutoDetectWriter.cs
- FixedTextBuilder.cs
- FunctionImportMapping.cs
- ColorConvertedBitmap.cs
- PlatformNotSupportedException.cs
- IISMapPath.cs
- WindowsScrollBarBits.cs
- ZipIOFileItemStream.cs
- PropertyDescriptorCollection.cs
- ServiceModelSecurityTokenTypes.cs
- CompareValidator.cs
- DbConnectionStringBuilder.cs
- RequestResponse.cs
- WebPartDescription.cs
- HtmlContainerControl.cs
- DataKey.cs
- BoundingRectTracker.cs
- FilterElement.cs
- ObjectToken.cs
- EntityPropertyMappingAttribute.cs
- DefaultValueTypeConverter.cs
- RelationshipConverter.cs
- Splitter.cs
- PrtCap_Base.cs
- SrgsElementFactoryCompiler.cs
- CommandHelpers.cs
- AttributeQuery.cs
- BinaryObjectWriter.cs
- Validator.cs
- NotifyParentPropertyAttribute.cs
- WeakReferenceKey.cs
- XmlSchemaElement.cs
- InputProcessorProfilesLoader.cs
- ElementHostAutomationPeer.cs
- Panel.cs
- BamlRecords.cs
- TdsParameterSetter.cs
- Gdiplus.cs
- DecimalKeyFrameCollection.cs
- ProxyWebPartConnectionCollection.cs
- MembershipSection.cs
- MenuItemCollection.cs
- Dictionary.cs
- BackgroundFormatInfo.cs
- OdbcFactory.cs
- NonClientArea.cs
- GradientStop.cs
- GB18030Encoding.cs
- RecognizeCompletedEventArgs.cs
- dataobject.cs
- StringAnimationUsingKeyFrames.cs
- PathFigureCollection.cs
- RuntimeEnvironment.cs
- BitmapEffectvisualstate.cs
- TypeSource.cs
- KeySplineConverter.cs
- InternalBufferOverflowException.cs
- DiagnosticSection.cs
- MatrixStack.cs
- EnvironmentPermission.cs
- SamlEvidence.cs
- DependencyPropertyDescriptor.cs
- NonPrimarySelectionGlyph.cs
- PageContent.cs
- MinimizableAttributeTypeConverter.cs
- Propagator.JoinPropagator.cs
- MimeBasePart.cs
- WebContext.cs
- TraceContextRecord.cs
- CompModSwitches.cs
- ResourcePropertyMemberCodeDomSerializer.cs
- ObjRef.cs
- ToolStripSettings.cs
- EncodingStreamWrapper.cs
- Literal.cs