Method AsObject
AsObject<TResult, T1>(IRecord, Func<T1, TResult>)
Converts the record to an object using the given delegate.
public static TResult AsObject<TResult, T1>(this IRecord record, Func<T1, TResult> map)
Parameters
recordIRecordThe record to convert.
mapFunc<T1, TResult>A delegate that defines the mapping from the record to the result object. The names of the parameters accepted by the delegate will be used to lookup values in the record, those values will be converted to the types of the parameters, and then the delegate will be invoked to create the result object.
Returns
- TResult
The mapped object.
Type Parameters
TResultThe type that the supplied delegate returns.
T1The type of the first parameter of the delegate.
Examples
Given a record with key a, the following code will map the record to an object with property a of type
int:
var record = ...; // obtain a record somehow
var result = record.AsObject((int a) => new { a });
AsObject<TResult, T1, T2>(IRecord, Func<T1, T2, TResult>)
Converts the record to an object using the given delegate.
public static TResult AsObject<TResult, T1, T2>(this IRecord record, Func<T1, T2, TResult> map)
Parameters
recordIRecordThe record to convert.
mapFunc<T1, T2, TResult>A delegate that defines the mapping from the record to the result object. The names of the parameters accepted by the delegate will be used to lookup values in the record, those values will be converted to the types of the parameters, and then the delegate will be invoked to create the result object.
Returns
- TResult
The mapped object.
Type Parameters
TResultThe type that the supplied delegate returns.
T1The type of the first parameter of the delegate.
T2The type of the second parameter of the delegate.
Examples
Given a record with keys a and b, the following code will map the record to an object with properties
a of type int and b of type string:
var record = ...; // obtain a record somehow
var result = record.AsObject((int a, string b) => new { a, b });
AsObject<TResult, T1, T2, T3>(IRecord, Func<T1, T2, T3, TResult>)
Converts the record to an object using the given delegate.
public static TResult AsObject<TResult, T1, T2, T3>(this IRecord record, Func<T1, T2, T3, TResult> map)
Parameters
recordIRecordThe record to convert.
mapFunc<T1, T2, T3, TResult>A delegate that defines the mapping from the record to the result object. The names of the parameters accepted by the delegate will be used to lookup values in the record, those values will be converted to the types of the parameters, and then the delegate will be invoked to create the result object.
Returns
- TResult
The mapped object.
Type Parameters
TResultThe type that the supplied delegate returns.
T1The type of the first parameter of the delegate.
T2The type of the second parameter of the delegate.
T3The type of the third parameter of the delegate.
Examples
Given a record with keys a, b and c, the following code will map the record to an object with
properties a of type int, b of type string and c of type bool:
var record = ...; // obtain a record somehow
var result = record.AsObject((int a, string b, bool c) => new { a, b, c });
AsObject<TResult, T1, T2, T3, T4>(IRecord, Func<T1, T2, T3, T4, TResult>)
Converts the record to an object using the given delegate.
public static TResult AsObject<TResult, T1, T2, T3, T4>(this IRecord record, Func<T1, T2, T3, T4, TResult> map)
Parameters
recordIRecordThe record to convert.
mapFunc<T1, T2, T3, T4, TResult>A delegate that defines the mapping from the record to the result object. The names of the parameters accepted by the delegate will be used to lookup values in the record, those values will be converted to the types of the parameters, and then the delegate will be invoked to create the result object.
Returns
- TResult
The mapped object.
Type Parameters
TResultThe type that the supplied delegate returns.
T1The type of the first parameter of the delegate.
T2The type of the second parameter of the delegate.
T3The type of the third parameter of the delegate.
T4The type of the fourth parameter of the delegate.
Examples
Given a record with keys a, b, c and d, the following code will map the record to an object
with properties a of type int, b of type string, c of type bool and d of type double:
var record = ...; // obtain a record somehow
var result = record.AsObject((int a, string b, bool c, double d) => new { a, b, c, d });
AsObject<TResult, T1, T2, T3, T4, T5>(IRecord, Func<T1, T2, T3, T4, T5, TResult>)
Converts the record to an object using the given delegate.
public static TResult AsObject<TResult, T1, T2, T3, T4, T5>(this IRecord record, Func<T1, T2, T3, T4, T5, TResult> map)
Parameters
recordIRecordThe record to convert.
mapFunc<T1, T2, T3, T4, T5, TResult>A delegate that defines the mapping from the record to the result object. The names of the parameters accepted by the delegate will be used to lookup values in the record, those values will be converted to the types of the parameters, and then the delegate will be invoked to create the result object.
Returns
- TResult
The mapped object.
Type Parameters
TResultThe type that the supplied delegate returns.
T1The type of the first parameter of the delegate.
T2The type of the second parameter of the delegate.
T3The type of the third parameter of the delegate.
T4The type of the fourth parameter of the delegate.
T5The type of the fifth parameter of the delegate.
Examples
Given a record with keys a, b, c, d and e, the following code will map the record to
an object with properties a of type int, b of type string, c of type bool, d of type double
and e of type long:
var record = ...; // obtain a record somehow
var result = record.AsObject((int a, string b, bool c, double d, long e) => new { a, b, c, d, e });
AsObject<TResult, T1, T2, T3, T4, T5, T6>(IRecord, Func<T1, T2, T3, T4, T5, T6, TResult>)
Converts the record to an object using the given delegate.
public static TResult AsObject<TResult, T1, T2, T3, T4, T5, T6>(this IRecord record, Func<T1, T2, T3, T4, T5, T6, TResult> map)
Parameters
recordIRecordThe record to convert.
mapFunc<T1, T2, T3, T4, T5, T6, TResult>A delegate that defines the mapping from the record to the result object. The names of the parameters accepted by the delegate will be used to lookup values in the record, those values will be converted to the types of the parameters, and then the delegate will be invoked to create the result object.
Returns
- TResult
The mapped object.
Type Parameters
TResultThe type that the supplied delegate returns.
T1The type of the first parameter of the delegate.
T2The type of the second parameter of the delegate.
T3The type of the third parameter of the delegate.
T4The type of the fourth parameter of the delegate.
T5The type of the fifth parameter of the delegate.
T6The type of the sixth parameter of the delegate.
Examples
Given a record with keys a, b, c, d, e and f, the following code will map the
record to an object with properties a of type int, b of type string, c of type bool, d of
type double, e of type long and f of type float:
var record = ...; // obtain a record somehow
var result = record.AsObject((int a, string b, bool c, double d, long e, float f) => new { a, b, c, d, e, f });
AsObject<TResult, T1, T2, T3, T4, T5, T6, T7>(IRecord, Func<T1, T2, T3, T4, T5, T6, T7, TResult>)
Converts the record to an object using the given delegate.
public static TResult AsObject<TResult, T1, T2, T3, T4, T5, T6, T7>(this IRecord record, Func<T1, T2, T3, T4, T5, T6, T7, TResult> map)
Parameters
recordIRecordThe record to convert.
mapFunc<T1, T2, T3, T4, T5, T6, T7, TResult>A delegate that defines the mapping from the record to the result object. The names of the parameters accepted by the delegate will be used to lookup values in the record, those values will be converted to the types of the parameters, and then the delegate will be invoked to create the result object.
Returns
- TResult
The mapped object.
Type Parameters
TResultThe type that the supplied delegate returns.
T1The type of the first parameter of the delegate.
T2The type of the second parameter of the delegate.
T3The type of the third parameter of the delegate.
T4The type of the fourth parameter of the delegate.
T5The type of the fifth parameter of the delegate.
T6The type of the sixth parameter of the delegate.
T7The type of the seventh parameter of the delegate.
Examples
Given a record with keys a, b, c, d, e, f and g, the following code
will map the record to an object with properties a of type int, b of type string, c of type bool,
d of type double, e of type long, f of type float and g of type decimal:
var record = ...; // obtain a record somehow
var result = record.AsObject(
(int a, string b, bool c, double d, long e, float f, decimal g) =>
new { a, b, c, d, e, f, g });
AsObject<TResult, T1, T2, T3, T4, T5, T6, T7, T8>(IRecord, Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult>)
Converts the record to an object using the given delegate.
public static TResult AsObject<TResult, T1, T2, T3, T4, T5, T6, T7, T8>(this IRecord record, Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult> map)
Parameters
recordIRecordThe record to convert.
mapFunc<T1, T2, T3, T4, T5, T6, T7, T8, TResult>A delegate that defines the mapping from the record to the result object. The names of the parameters accepted by the delegate will be used to lookup values in the record, those values will be converted to the types of the parameters, and then the delegate will be invoked to create the result object.
Returns
- TResult
The mapped object.
Type Parameters
TResultThe type that the supplied delegate returns.
T1The type of the first parameter of the delegate.
T2The type of the second parameter of the delegate.
T3The type of the third parameter of the delegate.
T4The type of the fourth parameter of the delegate.
T5The type of the fifth parameter of the delegate.
T6The type of the sixth parameter of the delegate.
T7The type of the seventh parameter of the delegate.
T8The type of the eighth parameter of the delegate.
Examples
Given a record with keys a, b, c, d, e, f, g and h, the
following code will map the record to an object with properties a of type int, b of type string, c
of type bool, d of type double, e of type long, f of type float, g of type decimal and
h of type byte:
var record = ...; // obtain a record somehow
var result = record.AsObject(
(int a, string b, bool c, double d, long e, float f, decimal g, byte h) =>
new { a, b, c, d, e, f, g, h });
AsObject<TResult, T1, T2, T3, T4, T5, T6, T7, T8, T9>(IRecord, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>)
Converts the record to an object using the given delegate.
public static TResult AsObject<TResult, T1, T2, T3, T4, T5, T6, T7, T8, T9>(this IRecord record, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> map)
Parameters
recordIRecordThe record to convert.
mapFunc<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>A delegate that defines the mapping from the record to the result object. The names of the parameters accepted by the delegate will be used to lookup values in the record, those values will be converted to the types of the parameters, and then the delegate will be invoked to create the result object.
Returns
- TResult
The mapped object.
Type Parameters
TResultThe type that the supplied delegate returns.
T1The type of the first parameter of the delegate.
T2The type of the second parameter of the delegate.
T3The type of the third parameter of the delegate.
T4The type of the fourth parameter of the delegate.
T5The type of the fifth parameter of the delegate.
T6The type of the sixth parameter of the delegate.
T7The type of the seventh parameter of the delegate.
T8The type of the eighth parameter of the delegate.
T9The type of the ninth parameter of the delegate.
Examples
Given a record with keys a, b, c, d, e, f, g, h and i,
the following code will map the record to an object with properties a of type int, b of type string,
c of type bool, d of type double, e of type long, f of type float, g of type
decimal, h of type byte and i of type short:
var record = ...; // obtain a record somehow
var result = record.AsObject(
(int a, string b, bool c, double d, long e, float f, decimal g, byte h, short i) =>
new { a, b, c, d, e, f, g, h, i });
AsObject<TResult, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(IRecord, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>)
Converts the record to an object using the given delegate.
public static TResult AsObject<TResult, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(this IRecord record, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> map)
Parameters
recordIRecordThe record to convert.
mapFunc<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>A delegate that defines the mapping from the record to the result object. The names of the parameters accepted by the delegate will be used to lookup values in the record, those values will be converted to the types of the parameters, and then the delegate will be invoked to create the result object.
Returns
- TResult
The mapped object.
Type Parameters
TResultThe type that the supplied delegate returns.
T1The type of the first parameter of the delegate.
T2The type of the second parameter of the delegate.
T3The type of the third parameter of the delegate.
T4The type of the fourth parameter of the delegate.
T5The type of the fifth parameter of the delegate.
T6The type of the sixth parameter of the delegate.
T7The type of the seventh parameter of the delegate.
T8The type of the eighth parameter of the delegate.
T9The type of the ninth parameter of the delegate.
T10The type of the tenth parameter of the delegate.
Examples
Given a record with keys a, b, c, d, e, f, g, h, i and
j, the following code will map the record to an object with properties a of type int, b of type
string, c of type bool, d of type double, e of type long, f of type float, g of type
decimal, h of type byte, i of type short and j of type ushort:
var record = ...; // obtain a record somehow
var result = record.AsObject(
(int a, string b, bool c, double d, long e, float f, decimal g, byte h, short i, ushort j) =>
new { a, b, c, d, e, f, g, h, i, j });