Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / ndp / fx / src / DataSet / System / Data / DataRowExtensions.cs / 1 / DataRowExtensions.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //spather //----------------------------------------------------------------------------- using System; using System.Data.DataSetExtensions; namespace System.Data { ////// This static class defines the DataRow extension methods. /// public static class DataRowExtensions { ////// This method provides access to the values in each of the columns in a given row. /// This method makes casts unnecessary when accessing columns. /// Additionally, Field supports nullable types and maps automatically between DBNull and /// Nullable when the generic type is nullable. /// /// /// The input DataRow /// /// /// The input column name specificy which row value to retrieve. /// ////// The DataRow value for the column specified. /// public static T Field(this DataRow row, string columnName) { DataSetUtil.CheckArgumentNull(row, "row"); return UnboxT .Unbox(row[columnName]); } /// /// This method provides access to the values in each of the columns in a given row. /// This method makes casts unnecessary when accessing columns. /// Additionally, Field supports nullable types and maps automatically between DBNull and /// Nullable when the generic type is nullable. /// /// /// The input DataRow /// /// /// The input DataColumn specificy which row value to retrieve. /// ////// The DataRow value for the column specified. /// public static T Field(this DataRow row, DataColumn column) { DataSetUtil.CheckArgumentNull(row, "row"); return UnboxT .Unbox(row[column]); } /// /// This method provides access to the values in each of the columns in a given row. /// This method makes casts unnecessary when accessing columns. /// Additionally, Field supports nullable types and maps automatically between DBNull and /// Nullable when the generic type is nullable. /// /// /// The input DataRow /// /// /// The input ordinal specificy which row value to retrieve. /// ////// The DataRow value for the column specified. /// public static T Field(this DataRow row, int columnIndex) { DataSetUtil.CheckArgumentNull(row, "row"); return UnboxT .Unbox(row[columnIndex]); } /// /// This method provides access to the values in each of the columns in a given row. /// This method makes casts unnecessary when accessing columns. /// Additionally, Field supports nullable types and maps automatically between DBNull and /// Nullable when the generic type is nullable. /// /// /// The input DataRow /// /// /// The input ordinal specificy which row value to retrieve. /// /// /// The DataRow version for which row value to retrieve. /// ////// The DataRow value for the column specified. /// public static T Field(this DataRow row, int columnIndex, DataRowVersion version) { DataSetUtil.CheckArgumentNull(row, "row"); return UnboxT .Unbox(row[columnIndex, version]); } /// /// This method provides access to the values in each of the columns in a given row. /// This method makes casts unnecessary when accessing columns. /// Additionally, Field supports nullable types and maps automatically between DBNull and /// Nullable when the generic type is nullable. /// /// /// The input DataRow /// /// /// The input column name specificy which row value to retrieve. /// /// /// The DataRow version for which row value to retrieve. /// ////// The DataRow value for the column specified. /// public static T Field(this DataRow row, string columnName, DataRowVersion version) { DataSetUtil.CheckArgumentNull(row, "row"); return UnboxT .Unbox(row[columnName, version]); } /// /// This method provides access to the values in each of the columns in a given row. /// This method makes casts unnecessary when accessing columns. /// Additionally, Field supports nullable types and maps automatically between DBNull and /// Nullable when the generic type is nullable. /// /// /// The input DataRow /// /// /// The input DataColumn specificy which row value to retrieve. /// /// /// The DataRow version for which row value to retrieve. /// ////// The DataRow value for the column specified. /// public static T Field(this DataRow row, DataColumn column, DataRowVersion version) { DataSetUtil.CheckArgumentNull(row, "row"); return UnboxT .Unbox(row[column, version]); } /// /// This method sets a new value for the specified column for the DataRow it�s called on. /// /// /// The input DataRow. /// /// /// The input ordinal specifying which row value to set. /// /// /// The new row value for the specified column. /// public static void SetField(this DataRow row, int columnIndex, T value) { DataSetUtil.CheckArgumentNull(row, "row"); row[columnIndex] = (object)value ?? DBNull.Value; } /// /// This method sets a new value for the specified column for the DataRow it�s called on. /// /// /// The input DataRow. /// /// /// The input column name specificy which row value to retrieve. /// /// /// The new row value for the specified column. /// public static void SetField(this DataRow row, string columnName, T value) { DataSetUtil.CheckArgumentNull(row, "row"); row[columnName] = (object)value ?? DBNull.Value; } /// /// This method sets a new value for the specified column for the DataRow it�s called on. /// /// /// The input DataRow. /// /// /// The input DataColumn specificy which row value to retrieve. /// /// /// The new row value for the specified column. /// public static void SetField(this DataRow row, DataColumn column, T value) { DataSetUtil.CheckArgumentNull(row, "row"); row[column] = (object)value ?? DBNull.Value; } private static class UnboxT { internal static readonly Converter
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- BooleanKeyFrameCollection.cs
- CompiledRegexRunnerFactory.cs
- MarshalByValueComponent.cs
- TreeNodeStyleCollection.cs
- XsdSchemaFileEditor.cs
- AQNBuilder.cs
- SHA384Managed.cs
- OpacityConverter.cs
- ClientBuildManager.cs
- PeerChannelListener.cs
- WinFormsComponentEditor.cs
- ConnectionPoint.cs
- SafeHandle.cs
- HealthMonitoringSection.cs
- GlyphCollection.cs
- DbConnectionPoolOptions.cs
- BindingContext.cs
- IList.cs
- XmlConvert.cs
- HttpFileCollectionBase.cs
- WebPartVerb.cs
- SimpleTextLine.cs
- HostingEnvironmentSection.cs
- WsdlBuildProvider.cs
- ScriptReferenceBase.cs
- SoapObjectReader.cs
- ScrollViewerAutomationPeer.cs
- ObjectDataSourceEventArgs.cs
- Input.cs
- GeometryCombineModeValidation.cs
- Point3DCollectionValueSerializer.cs
- TransactionContextValidator.cs
- SchemaAttDef.cs
- ItemChangedEventArgs.cs
- ReadOnlyCollection.cs
- ByteStorage.cs
- BoundColumn.cs
- SessionStateContainer.cs
- Collection.cs
- BrowserCapabilitiesCodeGenerator.cs
- webbrowsersite.cs
- ContentPosition.cs
- Image.cs
- FrameDimension.cs
- FormView.cs
- TextOnlyOutput.cs
- InvalidateEvent.cs
- MessageDecoder.cs
- PropertyEmitter.cs
- ResourcePermissionBase.cs
- StreamGeometry.cs
- WindowsContainer.cs
- ContainerParagraph.cs
- FormCollection.cs
- HtmlContainerControl.cs
- MetafileHeaderWmf.cs
- BindingList.cs
- ApplicationSecurityInfo.cs
- BooleanAnimationUsingKeyFrames.cs
- WebSysDisplayNameAttribute.cs
- SafeNativeMethodsMilCoreApi.cs
- _SSPIWrapper.cs
- SigningCredentials.cs
- Point3DConverter.cs
- BitmapInitialize.cs
- SinglePageViewer.cs
- GenericTypeParameterBuilder.cs
- Stopwatch.cs
- XmlComplianceUtil.cs
- LayeredChannelListener.cs
- TypeResolver.cs
- HealthMonitoringSection.cs
- VirtualPathUtility.cs
- SurrogateEncoder.cs
- _CacheStreams.cs
- DBPropSet.cs
- AndCondition.cs
- ItemCollectionEditor.cs
- ConfigurationSection.cs
- PointCollectionConverter.cs
- DataRowExtensions.cs
- Transform.cs
- DetailsViewUpdatedEventArgs.cs
- SqlDataSourceConfigureSortForm.cs
- CheckBoxFlatAdapter.cs
- ObjectNotFoundException.cs
- Marshal.cs
- ThreadInterruptedException.cs
- DataGridItem.cs
- WebEvents.cs
- InheritanceContextHelper.cs
- DateTimeSerializationSection.cs
- MetadataAssemblyHelper.cs
- AnnouncementDispatcherAsyncResult.cs
- CodeNamespace.cs
- ExternalException.cs
- PropertyGrid.cs
- SafeBitVector32.cs
- ArgumentDesigner.xaml.cs
- XPathNodeIterator.cs