A Sandcastle Documented Class Library

# DbDataReaderExtensions FieldValueOrDefault T Method

Gets the field value or default(), if the value is DBNull.

Namespace: Dundas.BI.Data
Assembly: Dundas.BI.Core (in Dundas.BI.Core.dll) Version: 2.0.0.0 (10.0.0.1002)
Syntax
C#
VB
C++
F#
Copy

    public static T FieldValueOrDefault<T>(
    	this DbDataReader target,
    	string name
    )

    <ExtensionAttribute>
    Public Shared Function FieldValueOrDefault(Of T) (
    	target As DbDataReader,
    	name As String
    ) As T

    public:
    [ExtensionAttribute]
    generic<typename T>
    static T FieldValueOrDefault(
    	DbDataReader^ target,
    	String^ name
    )

    [<ExtensionAttribute>]
    static member FieldValueOrDefault :
            target : DbDataReader *
            name : string -> 'T

#### Parameters

target
  Type: System.Data.Common
  DbDataReader
  The data reader.
name
  Type: System
  String
  The name of the column.

#### Type Parameters

T
  The type of the value to be returned.

#### Return Value

Type: T
The field value or default(), if the value is DBNull.

#### Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type DbDataReader. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Exceptions

Exception | Condition
--- | ---
ArgumentNullException | target or name is .

See Also

#### Reference

DbDataReaderExtensions Class
Dundas.BI.Data Namespace