IDataReaderExtensionsAsEnumerable Method
Enumerates all the IDataRecord items in the
source IDataReader stream,
and returns a IEnumerableT collection.
Namespace: DevCase.Extensions.IDataReaderExtensionsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[EditorBrowsableAttribute(EditorBrowsableState.Always)]
public static IEnumerable<IDataRecord> AsEnumerable(
this IDataReader reader
)
<ExtensionAttribute>
<EditorBrowsableAttribute(EditorBrowsableState.Always)>
Public Shared Function AsEnumerable (
reader As IDataReader
) As IEnumerable(Of IDataRecord)
Dim reader As IDataReader
Dim returnValue As IEnumerable(Of IDataRecord)
returnValue = reader.AsEnumerable()
public:
[ExtensionAttribute]
[EditorBrowsableAttribute(EditorBrowsableState::Always)]
static IEnumerable<IDataRecord^>^ AsEnumerable(
IDataReader^ reader
)
[<ExtensionAttribute>]
[<EditorBrowsableAttribute(EditorBrowsableState.Always)>]
static member AsEnumerable :
reader : IDataReader -> IEnumerable<IDataRecord>
No code example is currently available or this language may not be supported.
- reader IDataReader
-
The source IDataReader stream.
IEnumerableIDataRecord
The resulting
IEnumerableT collection.
In Visual Basic and C#, you can call this method as an instance method on any object of type
IDataReader. 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).
This is a code example.
No code example is currently available or this language may not be supported.
Using connection As New SqlConnection("some connection string"),
command As New SqlCommand("select * from products", connection)
connection.Open()
Using reader As SqlDataReader = command.ExecuteReader()
Dim results As IEnumerable(Of IDataRecord) = reader.AsEnumerable().Select(
Function(record)
Return New Product With {
.Name = CStr(record("product_name")),
.Id = CInt(Math.Truncate(record("product_id"))),
.Category = CStr(record("product_category"))
}
End Function).GroupBy(Function(product) product.Category)
End Using
End Using
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.