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
- CngProperty.cs
- HtmlInputSubmit.cs
- HostExecutionContextManager.cs
- HierarchicalDataSourceControl.cs
- DependencyStoreSurrogate.cs
- StoragePropertyMapping.cs
- RunInstallerAttribute.cs
- listviewsubitemcollectioneditor.cs
- NotifyInputEventArgs.cs
- Point3DValueSerializer.cs
- CqlQuery.cs
- KeySpline.cs
- PolicyManager.cs
- UnitySerializationHolder.cs
- AsyncResult.cs
- DesignerObject.cs
- StateMachineAction.cs
- TimeEnumHelper.cs
- WebBrowserEvent.cs
- XmlElementAttribute.cs
- DataGridHeaderBorder.cs
- RequestCacheEntry.cs
- XmlUtil.cs
- COM2PictureConverter.cs
- PenThreadWorker.cs
- ComponentEvent.cs
- JsonSerializer.cs
- XmlCountingReader.cs
- DataGridViewRowPostPaintEventArgs.cs
- SocketPermission.cs
- IisTraceWebEventProvider.cs
- CodeExporter.cs
- SqlExpressionNullability.cs
- AdapterUtil.cs
- ProcessHost.cs
- WindowsFormsHelpers.cs
- ToolStripSeparator.cs
- Visitors.cs
- TreeIterator.cs
- FixedPosition.cs
- ApplicationContext.cs
- SSmlParser.cs
- CodeVariableDeclarationStatement.cs
- InkSerializer.cs
- FormViewUpdateEventArgs.cs
- XmlnsPrefixAttribute.cs
- FeatureAttribute.cs
- IFlowDocumentViewer.cs
- FilteredDataSetHelper.cs
- WriteFileContext.cs
- MethodSet.cs
- FileChangesMonitor.cs
- securitymgrsite.cs
- versioninfo.cs
- Clock.cs
- CompositeDataBoundControl.cs
- ProfileManager.cs
- SystemEvents.cs
- SynchronizingStream.cs
- EpmSyndicationContentDeSerializer.cs
- HtmlGenericControl.cs
- XmlDataDocument.cs
- Point4D.cs
- MetadataArtifactLoaderCompositeFile.cs
- ISAPIRuntime.cs
- ObjectTag.cs
- GPPOINT.cs
- BuildProvider.cs
- KeyValuePair.cs
- MetadataItem.cs
- Rotation3DAnimationBase.cs
- DesignSurfaceServiceContainer.cs
- TreeBuilder.cs
- KeyConstraint.cs
- EntityTypeEmitter.cs
- SpeechRecognizer.cs
- InstanceStore.cs
- DropDownHolder.cs
- CollaborationHelperFunctions.cs
- TimerElapsedEvenArgs.cs
- ValidationErrorCollection.cs
- StringUtil.cs
- SoapCodeExporter.cs
- MinimizableAttributeTypeConverter.cs
- XDRSchema.cs
- CreateUserErrorEventArgs.cs
- ConnectionStringsExpressionBuilder.cs
- QueryTask.cs
- TreeNodeClickEventArgs.cs
- SplayTreeNode.cs
- ReadOnlyDictionary.cs
- TheQuery.cs
- DBDataPermissionAttribute.cs
- SelectedGridItemChangedEvent.cs
- TablePatternIdentifiers.cs
- CqlGenerator.cs
- NetworkCredential.cs
- CharEntityEncoderFallback.cs
- ErrorStyle.cs
- DBConnectionString.cs