Method FromObjectsByReflection
FromObjectsByReflection<T>(IEnumerable<T>)
Opens a reader over typed records, binding every public readable instance property and field by name.
[RequiresUnreferencedCode("Binds merge fields by reflecting over T's public properties and fields, which trimming cannot see. Use FromObjects(records, MergeFieldMap<T>) in a trimmed application.")]
public static IMergeDataReader FromObjectsByReflection<T>(IEnumerable<T> records)
Parameters
recordsIEnumerable<T>The records. Enumerated once, lazily.
Returns
- IMergeDataReader
The reader, positioned before the first record.
Type Parameters
TThe record type.
Remarks
The convenience path, and the one that does not survive trimming: the properties are discovered reflectively, so a trimmed or NativeAOT application will see fields it cannot bind. The annotation moves that warning to the caller rather than hiding it. Use FromObjects<T>(IEnumerable<T>, MergeFieldMap<T>) in an application that trims.
Members are ordered by name, ordinal, so a merge is deterministic regardless of the order reflection happens to return them in.
Exceptions
- ArgumentNullException
recordsis null.