Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataSet / System / Data / TypedTableBaseExtensions.cs / 1305376 / TypedTableBaseExtensions.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //----------------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Globalization; using System.Diagnostics; namespace System.Data { ////// This static class defines the extension methods that add LINQ operator functionality /// within IEnumerableDT and IOrderedEnumerableDT. /// public static class TypedTableBaseExtensions { ////// LINQ's Where operator for generic EnumerableRowCollection. /// public static EnumerableRowCollectionWhere ( this TypedTableBase source, Func predicate) where TRow : DataRow { DataSetUtil.CheckArgumentNull(source, "source"); EnumerableRowCollection erc = new EnumerableRowCollection ((DataTable)source); return erc.Where (predicate); } /// /// LINQ's OrderBy operator for generic EnumerableRowCollection. /// public static OrderedEnumerableRowCollectionOrderBy ( this TypedTableBase source, Func keySelector) where TRow : DataRow { DataSetUtil.CheckArgumentNull(source, "source"); EnumerableRowCollection erc = new EnumerableRowCollection ((DataTable)source); return erc.OrderBy (keySelector); } /// /// LINQ's OrderBy operator for generic EnumerableRowCollection. /// public static OrderedEnumerableRowCollectionOrderBy ( this TypedTableBase source, Func keySelector, IComparer comparer) where TRow : DataRow { DataSetUtil.CheckArgumentNull(source, "source"); EnumerableRowCollection erc = new EnumerableRowCollection ((DataTable)source); return erc.OrderBy (keySelector, comparer); } /// /// LINQ's OrderByDescending operator for generic EnumerableRowCollection. /// public static OrderedEnumerableRowCollectionOrderByDescending ( this TypedTableBase source, Func keySelector) where TRow : DataRow { DataSetUtil.CheckArgumentNull(source, "source"); EnumerableRowCollection erc = new EnumerableRowCollection ((DataTable)source); return erc.OrderByDescending (keySelector); } /// /// LINQ's OrderByDescending operator for generic EnumerableRowCollection. /// public static OrderedEnumerableRowCollectionOrderByDescending ( this TypedTableBase source, Func keySelector, IComparer comparer) where TRow : DataRow { DataSetUtil.CheckArgumentNull(source, "source"); EnumerableRowCollection erc = new EnumerableRowCollection ((DataTable)source); return erc.OrderByDescending (keySelector, comparer); } /// /// Executes a Select (Projection) on EnumerableDataTable. If the selector returns a different /// type than the type of rows, then AsLinqDataView is disabled, and the returning EnumerableDataTable /// represents an enumerable over the LINQ Query. /// public static EnumerableRowCollectionSelect( this TypedTableBase source, Func selector) where TRow : DataRow { DataSetUtil.CheckArgumentNull(source, "source"); EnumerableRowCollection erc = new EnumerableRowCollection ((DataTable)source); return erc.Select (selector); } /// /// This method returns a IEnumerable of TRow. /// /// /// The source DataTable to make enumerable. /// ////// IEnumerable of datarows. /// public static EnumerableRowCollectionAsEnumerable (this TypedTableBase source) where TRow : DataRow { DataSetUtil.CheckArgumentNull(source, "source"); return new EnumerableRowCollection (source as DataTable); } } //end class } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ThaiBuddhistCalendar.cs
- EntityModelSchemaGenerator.cs
- DomNameTable.cs
- TypeExtensionSerializer.cs
- InternalCache.cs
- PassportAuthentication.cs
- SendingRequestEventArgs.cs
- ForceCopyBuildProvider.cs
- XPathSelfQuery.cs
- Double.cs
- SuppressIldasmAttribute.cs
- TemplateParser.cs
- InvalidDataException.cs
- GeneratedCodeAttribute.cs
- mediaeventshelper.cs
- SaveFileDialogDesigner.cs
- DateTimeSerializationSection.cs
- ComponentManagerBroker.cs
- PeerUnsafeNativeMethods.cs
- PngBitmapDecoder.cs
- Thumb.cs
- Span.cs
- KeysConverter.cs
- BufferBuilder.cs
- HtmlInputReset.cs
- MatrixTransform.cs
- SelectManyQueryOperator.cs
- PartitionResolver.cs
- PackageDigitalSignature.cs
- AddInController.cs
- ListControlDataBindingHandler.cs
- SettingsPropertyWrongTypeException.cs
- TextBoxRenderer.cs
- HtmlEmptyTagControlBuilder.cs
- Attributes.cs
- Statements.cs
- NameTable.cs
- MessageLogger.cs
- wgx_sdk_version.cs
- DisposableCollectionWrapper.cs
- RegexMatch.cs
- SynchronizingStream.cs
- EventHandlerService.cs
- Encoder.cs
- CodeGotoStatement.cs
- CompilerInfo.cs
- XmlStreamNodeWriter.cs
- AuthenticationServiceManager.cs
- SubstitutionDesigner.cs
- SerializerDescriptor.cs
- DBSchemaTable.cs
- ReachFixedPageSerializer.cs
- Activator.cs
- SessionKeyExpiredException.cs
- ReadOnlyDataSourceView.cs
- LongMinMaxAggregationOperator.cs
- TraceContext.cs
- DataGridViewDataErrorEventArgs.cs
- EventlogProvider.cs
- Span.cs
- RectAnimationClockResource.cs
- EmptyEnumerator.cs
- PrtCap_Builder.cs
- GraphicsPath.cs
- AssemblyCollection.cs
- TypeRefElement.cs
- RegexParser.cs
- ElementNotEnabledException.cs
- UniqueIdentifierService.cs
- TextBoxBase.cs
- TargetParameterCountException.cs
- ConnectionsZoneDesigner.cs
- AxHostDesigner.cs
- TextElementCollection.cs
- KnownIds.cs
- RectAnimationUsingKeyFrames.cs
- ConfigurationElement.cs
- HttpApplicationFactory.cs
- ScriptResourceAttribute.cs
- BooleanToVisibilityConverter.cs
- XmlWriter.cs
- DSACryptoServiceProvider.cs
- XappLauncher.cs
- SchemaElementLookUpTableEnumerator.cs
- SmtpFailedRecipientsException.cs
- ToggleButtonAutomationPeer.cs
- XmlNullResolver.cs
- PaperSize.cs
- Listbox.cs
- FrameDimension.cs
- FormClosingEvent.cs
- XmlArrayItemAttributes.cs
- DBConcurrencyException.cs
- ReachFixedPageSerializer.cs
- HostUtils.cs
- HandlerWithFactory.cs
- DefaultBindingPropertyAttribute.cs
- StylusButton.cs
- IPPacketInformation.cs
- CheckBox.cs